I’m having some trouble with Hugo’s new nested sections. I want to specify a custom layout for nested section list pages according to their parent sections, but I’m not sure where to put the layout file so that it gets used.
Let’s say I have two main sections on my site: post
and book
. post
is a flat section, but in book
I want a mix of direct items and subsections. The hierarchy looks like this:
content
├── _index.md
├── book
│ └── shortbook.md
│ └── book1
│ | ├── _index.md
│ | ├── chapter1.md
│ | ├── chapter2.md
│ | └── chapter3.md
│ └── book2
│ ├── _index.md
│ ├── chapter1.md
│ ├── chapter2.md
│ └── chapter3.md
└── post
├── _index.md
├── something.md
├── another.md
└── thing.md
I want to specify a custom layout for the /book/SECTION/
(or at least for /book/book1/
) list page.
As per this, I’ve tried placing a file at:
layouts/section/book1.html
layouts/book1/list.html
I’ve also tried:
layouts/book/book1/list.html
layouts/section/book/book1.html
layouts/_default/list.html
The last one achieves the desired effect, but has the obvious undesired side effect of changing the default list template site-wide. All the others just cause the /book/book1/
page to be rendered with the /themes/THEME/layouts/_default/list.html
template.
With this being such a new feature, is what I’m trying to do possible?