Single.html for root pages vs section pages

In fact I would consider frontmatter layout as part of the template system. (and with that cascading fixed values down, too avoiding repetition :wink:

imho just with the Template lookup order that is not possible.

Option 1: cascade in hugo.toml

[[cascade]]
    layout = 'blog'
  [cascade._target]
    path = '/*/**'
    kind = 'page'

now you have

  • a standard _default/single.html for the root pages
  • all subfolders will use _default/blog.html as template for single pages

Option 2: move toplevel folders to one section

/content/blog/hugo
/content/blog/seo
/content/blog/web

now you can create a single page template for section blog.


guess there are other possibilities, but these are the cleanest ones I can think of

1 Like