Taxonomy / bundle / section issue (possible Hugo bug)

Hugo does not consistently compile the following, which I think could be a bug. I’ve compiled a minimal working example on https://github.com/wpk-/hugo-issue.

The example shows a blog with a person/people taxonomy and a posts section. There is one post with two people (Bob and Charles) in its front matter. Bob has a page (branch) bundle in content/people/bob/, Charles does not but that’s fine. The third person, Anna, has a page (leaf) bundle in content/people/anna/.

The issue is the URL http://localhost:1313/people/ is inconsistently built by Hugo. Sometimes it lists only Anna and the title is “Peoples” (yuk, where did that come from!?). Other times it lists Bob and Charles but not Anna, and the title is “List of people” as per content/people/_index.md

When I wrote the README.md I thought at least the inconsistency was consistent (to reproduce) but I’ve since figured out it isn’t. Restart Hugo and you get a surprise every time. Touch a random file (to trigger a rebuild) and the page may change, but it doesn’t have to. I have yet to find it changes two times during a single server run, but that’s about the only consistency I found.

The main question is, what is Hugo actually supposed to render there? I don’t know. I had quietly hoped to get all three people…

Taxonomies look for metadata in /content/<TAXONOMY>/<TERM>/_index.md.

See https://gohugo.io/content-management/taxonomies/#add-custom-metadata-to-a-taxonomy-term and https://gohugo.io/templates/taxonomy-templates/#displaying-custom-metadata-in-taxonomy-terms-templates.

If you move alice/index.html to alice/_index.html the taxonomy template renders as expected.

Taxonomies and use of _index.html pre-dates page bundles, so that may cause some confusion. :slight_smile:

The bug arises from a clash between leaf/branch bundles and taxonomies it seems. Both consider the same structure and one of them wins: sometimes the taxonomy, sometimes the bundles. Apparently neither has precedence.

Of course renaming Anna’s file to _index.md makes the taxonomy work (thank you for the suggestion btw, as a practical solution this is exactly it), but then my code would not be a “minimal working example”…