My tag has “version 20.5”, the URL created for this tag is “/tags/version-20.5”. I want to know if there is any way I can remove or replace the “.” from URL. Or can you tell me how are these pages( “/tags/version-20.5”) getting created like which shortcode or partial creates these pages so that I can modify the URL there? I have tried slug, permalinks. Nothing is working. Slug is not getting used for tags.
content/posts/post-1.md
+++
title = 'Post 1'
tags = ['version 20.5']
+++
Then create the term page:
hugo new tags/version-20.5/_index.md
content/tags/version-20.5/_index.md
+++
title = 'Version 20.5'
url = 'tags/version-20-5' # No leading slash
+++
See https://gohugo.io/content-management/urls/#front-matter
Finally, to properly render the tags for a given page:
{{ with .GetTerms "tags" }}
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}
2 Likes
{{ with .GetTerms "tags" }}
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}
This I have to add in layouts/terms.html?
Thank you so much It is working
No. You can place that in a single page template (e.g., layouts/_default/single.html) if you want to display a list of tags assigned to the page.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.