I’ve got a fairly simple blog with tags and I’m having difficulty getting the links and titles of tags to be what I want.
Links to tag pages
In the front matter of a post I have:
tags = ["website", "CI/CD", "Gitlab"]
And at the bottom of the page I list the tags with:
{{ range .Params.Tags }}
<li><a href="/tags/{{ . | urlize }} ">{{ . }}</a></li>
{{ end }}
the problem is that URL goes to /tags/ci/cd whereas Hugo makes the directory at /tags/ci-cd (result of the change here that replaces slashes in tags with hyphens)
How do I apply the same transform to the link automatically?
Titles
On the terms (list of tags) page and the list (pages matching a single tag) page, I’m not sure how to get the tag “CI/CD” to display correctly.
For a single term page (/tags/ci-cd/), I’ve tried the following options:
{{ .Title }} = "Ci/Cd"
{{ .Data.Term }} = "ci/cd"
I tried turning preserveTaxonomyNames on and off in config.toml but it doesn’t seem to be making a difference.
Thanks @rdwatters, that works. I thought there might be some built in function for that transformation, but if not, that does the trick!
Replaced it with the following because I couldn’t find the right way to escape the quote characters in the href string: