Cross Referencing Hugo


Published:   August 15, 2021

Tags:

In my blog, have started to cross-refernce now. Hugo has got support for this and designed in such a way that really make sense to me.

Documentation for this is here: https://gohugo.io/content-management/cross-references/

So to reference some post, you need to know about file path of that post. Proper reading would have made it easier but spent around 2hrs for this stupid things.

The ref and relref shortcodes require a single parameter: the path to a content document, with or without a file extension, with or without an anchor.

Instead of filepath went along with URL of the output file, and wasted all effort there, did all I could and later to realise that linking by URL doesn’t even make sense, path makes sense. Even if tomorrow you can permalink style, it won’t impact your reference link in hugo.

{{< ref "path-to-file.md" >}} or {{< ref "path-to-file" >}} both work fine

So for anchor tags: [text]({{< ref "path-to-file" >}})


< Prev   Further Reading   Next >

For feedback mail me at: email@murarisumit.in