Section pages that aren't lists

I want to have one section called news that’s for blog posts (which is easy, it happens like magic) and all the other sections for structured content. For example, I want a section like this:

content
└── comics   <-- an overview page with images, text, and links
    ├── published work <-- a page where I list published work
    ├── love-death-driving <-- a page about a specific comic             
    ├── this-was-2020 <-- another page about a different comic
    └── comic-object <-- a page about a type of art pieces

At first, I made all the subpages .md files, and of course Hugo replaced my top-level page with a list, which I now understand.

Now I’m making each subpage a directory to get pretty URLs, so I have for example content/comics/comic-object/index.md so that the URL will be site.com/comics/comic-object.

But what I’m getting instead is that in the Hugo server preview localhost:1313/comics becomes a list page randomly. Sometimes it goes back to displaying the content in my index.md file, sometimes it stubbornly remains a list, and when it does, sometimes not all the subfolders even show up in the list.

I just want Hugo to render my index.md in each of my top-level section folders, except the news folder which will be a growing list of posts.

Because the behavior seems to change randomly, I have no idea what to do. It seems to change sometimes when I use _index.md instead of index.md (or sometimes not, or sometimes does the opposite) and it seems to change sometimes if I just go into index.md and make a small change and save the file. Or it will stay the same. Until it doesn’t. Sometimes if I restart the server, the top-level page comes back the way I want it (my content, not a list) but the subpages are gone (still in the folders, but not rendered).

Is there a thing I’m supposed to be doing? Can’t figure this out after a couple hours with the docs.

You cannot have an index.md for your top level section because that way you are converting it into a Single Page Bundle and the pages below become its Page Resources (hence they may not render as individual pages).

Instead I suggest that you use an _index.md to keep /comics/ as a Section’s index page. Since you do not want it to be a list page of the Section’s content set the layout parameter in the _index.md front matter to a single page template.

There are examples about setting the layout parameter in a content file, please look it up by using the forum search.

Thanks. Tried it, and at first glance it seems to work.

The relationship between pages, bundles, templates, layouts, types, kinds, etc. is very confusing! Thanks for cutting through the maze for me.

I now understand a little more.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.