HUGO

Can you add taxonomies (e.g. tags) to _index.md pages?

I have a hugo site which uses tags (one form of taxonomy). I have noticed that if I add tags in the frontmatter to index.md pages, they work as expected, e.g. if I add to the frontmatter:

---
tags: [ "mytag" ]
---

will create a tag which can be accessed at mysite.com/tags/mytag/. It will also be listed as a tag on mysite.com/tags/.

However, if I instead add a tag to an _index.md page, mysite.com/tags/mytag/ is NOT created, and the tag is NOT listed on mysite,com/tags/.

This is a problem since due to other leaf bundle vs. lists bundle design considerations, my sites content is 100% _index.md pages and no index.md pages, hence even though I have 1000’s of tags no tag pages are created. Interestingly, the tags for each page are still listed correctly on each page through the .Params.tags variable.

I would have expected tags (and other taxonomies) to work on both content created with index.md and _index.md pages.

I am running Hugo v0.60.1.

This used to be possible, but is no longer possible with recent versions of Hugo. See this thread for more discussion (and a test case). At this time, I haven’t seen any official statement on whether this is an intentional change or a regression.

I don’t remember exactly when this change occurred. I first encountered it with Hugo 0.57 or thereabouts; if you want to drop back to an earlier Hugo version to fix your site, you’ll need to go at least that far back.

@gbmhunter Feel free to leave a comment on the Github issue help bring this issue to the developers!

1 Like

Thanks @angusm and @SHiLLySiT for the replies! I was hoping it was a mistake by me so it would be trivial to fix, unfortunately it seems not. I have left a reply on the Github issue and +1’ed it.