How shall I link a taxonomy page?

The tags of a content page can be accessed via .Params.tags. The Documentation on the site http://gohugo.io/taxonomies/displaying/ recommend the following way to list all page tags:

<ul id="tags">
  {{ range .Params.tags }}
    <li><a href="tags/{{ . | urlize }}">{{ . }}</a> </li>
  {{ end }}
</ul>

However, this code does not work in most cases since it produces dead links. Here I have found the following method:

    {{ range .Params.tags }}
  • {{ . }}
  • {{ end }}

Is this the recommended way to link to taxonomy pages from within a content page?

It doesn’t produce dead links. Put a “/” in front of tags so that its linking to the root. Cheers.

The second way seems better to me. Just sticking a / before tags is based on an assumption that root relative is correct, which won’t be the case if the site isn’t hosted at the root of the server. You can use relURL instead of absURL to get the relative url to the item if you prefer relative to absolute. Either way (assuming baseURL is set properly), that should create links that will work whether deployed to a site root or a subdir type url, like github/gitlab project pages.

I should have been more concrete. What do you recommend in creating a template when someone cannot be sure whether the website lies on the server’s root or whether there is a path prefix like in baseurl="http://example.com/hugo/". As Arnold suggests, the second way should be better because then the template doesn’t make any assumptions about baseurl… (with absURL or relURL).

I created a PR for updating the docs accordingly.