Single page layout for leaf bundle ignored

Hi lovely Hugo community

I’m doing my first steps with a custom layout for a section. I have a section donate with only index md-files in it. As this is a leaf bundle, I named the md-files index.en.md, index.de.md, index.fr.md and index.it.md for the four languages my page should support. I also created the file layout/donate/single.html as a custom layout for the mentioned donate section.

Unfortunately, this setup doesn’t seem to work, Hugo takes the layout/_default/single.html despite the custom section single page layout present. If I rename the index md-files to _index... the custom layout/donate/list.html is taken.

It seems as I misunderstand either how the custom section layouts work or how leaf bundles are precessed. You can find the example in this repo.

Any help is appreciated.

A folder with only “index.md” is, by definition, not a section.

To cut a story short:

  • You either need to put the pages below a section, e.g. “/mysection/about/index.md” (which I suspect you don’t want)
  • Or you could add type:donate to the front matter of these pages to pick the correct layout. You could also do layout:donate which would pick up the exact layout.

A related tip would be to look into the cascade keyword which would allow you to cascaded the type to a set of pages.