According to the documentation, this is the lookup order for the “/leafbundle/” in the example:
Single page in “posts” section
layouts/posts/single.html.html
layouts/posts/single.html
layouts/_default/single.html.html
layouts/_default/single.html
This means that “/content/leafbundle/index.md” should render from “/layouts/leafbundle/single.html”. But it renders from “/_default/single.html” instead.
For whatever reason, this works right with a branch bundle, see /branchbundle/ in the example.
I feel like the documentation is in the wrong here, as /_default/ gets priority over /leafbundle/, but only if I use “index.md” (leaf bundle) instead of “_index.md” (branch bundle).
This got closed as an issue, so I suppose it’s my understanding of the lookup order that is wrong, but I couldn’t figure this out the whole day.
Could somebody explain why /leafbundle/ is not working in my example as one would expext?
No, think of /content/leafbundle/index.md as /content/leafbundle.mdbut as a Leaf Bundle. /content/leafbundle/index.md is not technically inside a “leafbundle” section.
… /layouts/leafbundle/single.html applies to pages in leafbundle “section”.
/content/leafbundle/index.mdis not technically inside a “leafbundle” section.
This is the part I couldn’t comprehend up until this point. I think I understand now.
I really appreciate all of your input, things can get a little confusing until you have a solid grasp of what’s what.
I’ve managed to get over this issue by putting the demolayout.html into the _default folder, but it really bugged me that I didn’t understand why it’s not working, but now I do.
I’ve always hated web programming, but with hugo I’m actually enjoying it.
I found exactly the same issue. Thanks @dotleon and everyone for working through this!
My scenario was essentially trying to create a new layout by converting content/post-xyz.md to content/post-xyz/index.md, which lead me to think that we can just use layouts/post-xyz/single.md because this documentation page about Page Bundles shows that a leaf bundle is just a page of type single.
So long story short - the simple option is just to use:
an explicit front matter entry layout = post-xyz in index.md above