Confused about section page templates

see my layouts for my “shows” section:

now, my individual “shows” pages are turning out just fine, using the list.html template

such as:

but now i want a page one level above, at

what template do i use for this?

If memory serves me right, shows/list.html

Take a look at this:

I always get confused about which template file is being used. To fix it, I now make sure that the body classes include the name of the file being generated.

Actually the relevant template should be placed under /layouts/section/shows.html/

Also I will give you one more hint @blablabla (before you say that you still do not see anything rendered with the template path I specified above).

The /shows/ section (as things are currently setup) does not contain regular .Pages, but instead Nested Sections due to your use of in every directory. Had you used then these directories would have been regular .Pages.

So to populate the list under /shows/ (while keeping everything as is), you need to wrap everything right after the <main> tag within a range function and use the .Sections variable.

if i use and not, then what do i need for /shows/? --> list template used --> regular page template used

Therefore a simple range function to render these regular pages should be enough.

i.e. range .Pages

One last thing from me. The above template lookup PATH suggested by @brunoamaral is also correct.

However it all comes down to personal preference when it comes to maintaining a project.

Say you need custom layouts for several section lists.
With the above PATH you would need to create directories for each section under /layouts/<Section Name>/list.html
With the PATH I suggested you only need to create one directory under /layouts/section/<Section Name>.html

I always prefer to have as few directories as possible in a Hugo project (I h8 repetitive clicks).

i am even more confused now

check my new layout, where i cleaned up as per @alexandros suggestion

now, i wanna have a layout for which collects info from the Pages within /shows/ folder. What layout should i use? And how to collect data?

These questions are fundamental and out of scope here. You need to read the Docs about:
grouping content:
or even better go through the complete templates introduction:

And your issue is not a template lookup order issue.
You have not included any function to render the posts in your list page under:

Please re-read the replies I gave above and the links that I am posting to the Docs and if you still fail to render these posts in your list then ask again.

But we need to see some kind of working code.

We are not going to write the code for you. I’m sorry that’s the way it goes.


Also with your latest commit you turned the /shows/ section into a regular page by changing the to

As I said above --> Is for list pages = list template --> regular page = single page template

You need to revert the change you introduced in your last commit to turn this directory into a Hugo Section again.

Also do keep the under the various subfolders so that these are .Pages for you to render after reading the links I posted above.

1 Like

Perhaps this helps:

@alexandros indeed, i was hasty. apologies.

i figured it out! it was quite simple.

just to be extra super duper sure, i put my template for /shows/ under /layouts/shows/list.html

and for individual pages under /layouts/shows/single.html

this way, i get the best of all worlds: all “shows” templates under one folder, and individual pages accessible as .Pages

it finally clicked for me, thanks to @alexandros and all of you who are spending your personal time fixing my problems, thank you

for future reference, here is the template file:



Cool. I’m happy you sorted it out @blablabla :+1: