Help for single page section custom layout

Hi!

I am in need of some help to figure out what is wrong with my layout folder structure .

This is my layout folder structure:

.
├── index.html
├── partials
│   └── navigation.html
└── section
    ├── concerts
    │   └── single.html
    ├── concerts.html
...

I am trying to use the single.html custom layout for rendering the single pages I have in the content\concerts section folder. (concert1.md, concert2.md, etc…).

This is the content folder structure:

.
├── about
│   └── _index.md
├── concerts
│   ├── _index.md
│   ├── concert1.md
│   ├── concert2.md
│   ├── concert3.md
│   └── concert4.md
....

Hugo is rendering those single pages using the theme/THEME/layout/_default/single.html ignoring the custom template.

I have followed the Template Lookup Order in the docs, but I am probably doing something wrong an I cannot figure it out yet.

Could you please help?

Thank you!

I suggest placing the templates under layouts/concerts and then within said directory create a list.html for the section list and a single.html for the section’s single pages.

I think that with your current setup Hugo does not pickup the single template under the concerts directory because it encounters the concerts.html list template at the same level and processes it first, while ignoring the directory with the same name.

Thank you for quick reply.

I have changed the structure as suggested:

.
├── index.html
├── partials
│   └── navigation.html
└── section
    ├── concerts
    │   ├── list.html
    │   └── single.html
    └── contacts
        └── list.html

Unfortunately still not working. Now the concerts\list.html is also ignored, same goes for contacts.

Do you know if there are logs or something similar I can check?
Might be another template file is influencing it?

I read the template debugging docs but I am not sure it would help me at the moment.

Thanks again for all your help.

layouts/
├── concerts/
│   ├── list.html
│   └── single.html
└── _default/
    ├── list.html
    └── single.html

If you read https://gohugo.io/templates/lookup-order/ you will notice that none of the examples have multiple directories in the path.

Thanks!

For some reason my brain decided that section folder needed to be there.

Thank you for your help both of you.

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