serhii.net

In the middle of the desert you can say anything you want

03 Oct 2021

Day 1006

Hugo indexes and layouts

I think that:

  • Placing an _index.md in the root of the section makes it listable with a list.html template.
  • Placing an index.md (no underscore!) makes that file’s content the real index of that section.

The best way to use a custom layout is to specify it explicitly in the front matter as layout: newlayout. For example for the custom list template in pages (formerly /ntb/pages), I put the layout file in ./layouts/ntb/ntblist.html and put in ./content/ntb/pages/_index.md’s front matter this:

title: "Pages"
[...]
layout: ntblist
Nel mezzo del deserto posso dire tutto quello che voglio.