While I’ve seen nested sections covered in other posts, and I’ve got them to work according to the documentation by adding a _index.md file to the lower most sections, this is not ideal because it takes the simplicity out of the content folder and affects the .Title and prevents menus for the top section as well. I really just want a list for each nested section. I found an old example, but I can’t get it to work:
Thanks… I’ve seen that, but from what I can tell it just displays a menu of the nested sections, instead of actually rendering them. Even in the source code it is still using _index.md in the lower most sections in order to create a list of the sections, so content/section1/section2/test.md without an _index.md will render baseurl/section1/section2/test/, but baseurl/section1/section2/ will be a blank page.
Thank you, I’ve got that part working, but what I’m really trying to do is find a way around the _index.md requirement. Requiring _index.md in subsections is specific to Hugo and makes the content less portable overall. If you want to import a flat-file structure for Markdown notes, then normally you wouldn’t create these files. It would make more sense for Hugo to only use that file for creating custom titles and metadata for subsections, but still render the subsections without it if there is other markdown files present.
And if the _index.md was only for front matter, would you use it selectively?
What kind of <title> do you think that a rendered Nested Section list would have without front matter?
I’ll tell you what it would be: Either the PATH hierarchy of the Nested Section or the parent .Section or the .Site.Title.
Regarding your comment about portability, I don’t quite grasp how the use of _index.md reduces it.
You can always use a script to batch delete every single _index.md recursively from the root of a Hugo project whenever you feel like moving your project to another framework.
If _index.md was optional, then yes there may be times I would still use it to set a different title. I would want to use the filename/dirname generally. I’m currently using {{or .Title (replace .TranslationBaseName "-" " "|title)} to generate the title.
In terms of portability, I just don’t understand why you’d need that file. Many times you’re simply adding it so that your subsections work, when the first sections work as expected.