I run the newest version of Hugo 0.147.9 and when I have a page folder in my layouts with a single.html in it… the single in the root of the layouts folder will load for my pages (instead of the one in the page folder). This might be a bug.
How would one target the the single of the Kind ‘page’ in the new template layout?
I now use this in the page.html:
{{ if eq .Type "page" }}
...
{{ else }}
...
{{ end }}
Feels clunky to me. I would rather have a separate file.
Another problem with this approach is that is makes it impossible to not publish a page by using an empty single.html.
Also… the fact that your named layouts have to move from the page folder to the root of the layouts folder is a breaking change. Not that that is a problem… but maybe we should warn people for it.
Sorry… I think I wanted to have a specific layout for all ‘singles’ with .Type = page (no parent folder). Is that possible? I was mixing up .Type and .Kind. Sorry for the confusion.
layouts/
├── _defaults/
│ └── single.html (was empty so section singles would not be published)
├── page
│ └── single.html (was not empty, but had a nice page layout)
How do I do this in post v0.146.0? I prefer to use only 2 files.
I still don’t understand this, sorry. Perhaps you can provide an example repo? The example in your initial post doesn’t seem to match the use case you describe… which is a bit unusual.
I want to target the ‘singles’ for all sections and a separate file to target the ‘singles’ that have no section and have .Type = ‘page’. This was possible prior to v0.146.0, as descibed above. If this is no longer possible then that is a valid answer.