**
NOTE - The docs now include a full explanation of how to use _index.md files here:
https://gohugo.io/content/using-index-md/
**
From this thread I’d like to clear up some confusion I had in the hope it helps anyone who gets this particular case wrong like I did.
The matter relates to rendering the content of an _index.md file in a hierarchy like this:
content/post/_index.md
Remembering one thing - /post/ is a section and sections are rendered using list.html (or relevant section template) it makes sense that the single.html template is NOT used here because:
a) That’s what the docs say
b) That’s what the docs say
Seriously, I should have grokked it from the docs, but in my defence this page says:
To add content and frontmatter to the home page, a section, a taxonomy or a taxonomy terms listing, add a markdown file with the base name _index on the relevant place on the file system.
It gives the impression (to impressionable folks like me at least) that’s all you have to do.
But it’s not all you have to do.
You have to either ensure your default list.html file is written to ensure that it would render {{ .Content }} to actually render the content of the markdown page. Or you need to ensure you have a section layout (e.g. section/post.html) defined to do the same.
So, whilst technically ‘obvious’ that this is the case following the info in the docs it’s not completely clear that the _index.md content isn’t a ‘single’ page. It’s actually still a ‘list’ page as it’s being rendered at the root of a section.
So, don’t make the same mistake I did if you want actual content to render.
Incidentally, to head of any discussion on it - I for one am strongly against changing this behaviour. It’s current form is logically consistent with the template hierarchy and a simple clarification is all that needed IMHO.
A question on the official docs
What is the etiquette with updating docs on this project? Is anyone able to simply create a pull request with changes or are there guidelines in place to follow? I do not mind updating the docs to make this clearer to new folks (and slow ones like me )