I am currently in the process of creating a new Hugo site. When I wanted to add Terms of Service and Privacy Policy pages I created the file content/terms/_index.md and content/privacy/_index.md. Since they look exactly the same layout-wise I wanted to render them both with the same template located under layouts/legal/list.html and followed the steps in the documentation at http://gohugo.io/templates/lookup-order/ to do this. Like instructed I added the following front matter to the beginning of my files:
title = "Terms of Service/Privacy Policy"
type = "legal"
+++
This didn't work. After quite a bit of trying out and looking through the output of hugo -v I found the solution to be renaming layouts/legal/list.html to layouts/legal/single.html, moving both my _index.md files to the content folder and renaming them to terms.md and privacy.md respectively.
In my opinion this inconsistency in the handling of _index.md and other Markdown files is an issue and this behaviour shold be changed or at least documented.
PS: While it is the correct way to only lookup the single.html file or the specified file under layout in the front matter _index.md files are and edge case and should also lookup list.html layout files.
Could you move this issue to https://github.com/gohugoio/hugoDocs ?
I did move it, but I still think that the behaviour of hugo itself should be changed to be consistent.
Most helpful comment
I did move it, but I still think that the behaviour of hugo itself should be changed to be consistent.