bjorn.now
Björn Andersson
1 min read

Marking the content/ folder for your Hugo site as a “Source Root” in IntelliJ lets you use Path from Source Root to get the path to the file without the content/ prefix you don’t need when linking internally.

To make linking internally easier, I created an Alfred app snippet ({{< relref “{clipboard}” >}}), so now I only have to open the other post, double-tap shift, type “source root”, then run the snippet, and all linked up.

IntelliJ context menu showing Copy Path/Reference options with 'Path from Source Root' highlighted

Right-click folder → Mark Directory as → Sources Root.
To copy path: open file and search ‘source root’, or right-click → Copy Path/Reference → Path from Source Root