How to link pages

Hello, after a quick survey of the docs I got two ways for creating absolute links:

[Privacy Policy]({{< ref "/privacy-policy.md" >}}) // works only in MD
<a href="{{< ref "/privacy-policy.md" >}}">Privacy Policy</a>

I’m looking for something like this:

{{ makemealink . "/privacy-policy.md" }}

It should create the href attribute and the content, I would use it in the template file. Any suggestion?

Thanks

If you want to force your url paths to be absolute when the site is build check the config parameter canonifyURLs : Configure Hugo | Hugo

1 Like

And there is also the function absURL | Hugo
So you can do:

<a href="{{ "/privacy-policy.md" | absURL }}">Privacy Policy</a>
1 Like