I have a site with 3 categories. Articles in each category are stored in a folder of the same name. Sometimes, when I visit the category page URL, Hugo is using an layouts/learn/list.html instead of layouts/taxonomy/category.html. I have specified layout: "taxonony/category.html in the frontmatter of each _index.md page. Furthermore, when I run hugo serve in --disableFastRender mode this does not occur, but when I use hugo to build the site it occurs.
Unfortunately, I cannot post the code, as it’s private. I think what may be causing the problem is that my categories are named identically to my folder names. However, I am directly specifying the layout in each _index.md frontmatter, so it should always be rendered using that Layout.
Yes, that would cause issues. Taxonomies, terms, and content sections have different .Kind values in Hugo. This affects the lookup order that Hugo uses to select which template to use to generate your pages. If you have /foo/ as taxonomy, and also as a section, then there will be a collision. Sometimes it will render as taxonomy, sometimes not. Have a read here: Template lookup order | Hugo
The issue was solved by changing the folder names. However, In each folder’s index file, i specified the layout in the frontmatter, but it wouldn’t be used.