Nested sections without

While I’ve seen nested sections covered in other posts, and I’ve got them to work according to the documentation by adding a 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:

There may be a working example, but I can’t find one anywhere. I’d love to see this supported so that I can have a more simplified content structure.

1 Like

That is a 3 year example, long before Nested Sections.

Have a look at this repository instead:

It is by the maintainer of Hugo and last time I checked it had a Menu with the full Section Tree.

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 in the lower most sections in order to create a list of the sections, so content/section1/section2/ without an will render baseurl/section1/section2/test/, but baseurl/section1/section2/ will be a blank page.

Ok. Let me be clear. There can be no Nested Sections without because this is what activates them.

But do note that an is not needed to activate a top level Section or .FirstSection if you like.

The simplest way I found to create a conditional Nested Menu by Section is roughly outlined here:

To modify the layout of Nested Sections I use the following:

1 Like

Thank you, I’ve got that part working, but what I’m really trying to do is find a way around the requirement. Requiring 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 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 reduces it.

You can always use a script to batch delete every single recursively from the root of a Hugo project whenever you feel like moving your project to another framework.

If 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.

Are you asking me about the rationale of Development decisions that were made after a process that took months?

Well… Here you go (it’s a bit of a long read):

1 Like

Since it isn’t supported, then consider my message a feature request. Hopefully my post made enough sense to consider it as a future enhancement. All other functionality of could remain the same.