I wanted to add a tags taxonomy on a section-by-section basis, where those tags appear not under root/tags/[tag_name] but root/[section]/tags/[tag_name].
This wasn’t totally obvious (but is, sort of? in hindsight) — the trick is to just write the tag as follows in your config.toml (let’s assume the section you want the tags under is called ‘blog’):
[taxonomies]
tag = 'blog/tags'
And then, in the front matter for items in your /content/blog directory:
blog/tags:
- tag_1
- 'tag 2 with spaces'
Then, when you visit: https://root/blog/tags it will display /layouts/taxonomies/list.html.
My expected behavior before digging into this was the following:
- Add [taxonomies] tag=‘tags’ to config
- Just add tags to the front matter of any item within a section
- hugo would auto-generate the section/tags/ section/tags/tagname lists automatically
- I guess this is because I consider sections to be discrete elements / blocks of content, and wouldn’t expect to want to list tags / categories between them on a root level
Anyway, just a tip in case anyone else is searching for how to do this. (I didn’t see this technique explicitly mentioned in other threads.)