Hugo

Upgraded from 0.55.6 to v0.59.1: breaks headless behavior?

Hi folks,

I’ve just upgraded from v0.55.6 to v0.59.1, and leaf bundle behavior seems to have changed.

Given the following content structure:

 - books
    |- _index.md
    |- book1.md
    |- book2.md
    |- img
        |- authors
             |- index.md [headless = true]
             |- author1.jpg
             |- author2.jpg
        |- covers
             |- index.md [headless = true]
             |- cover1.jpg
             |- cover2.jpg
        |- publishers
             |- index.md [headless = true]
             |- publisher1.jpg
             |- publisher2.jpg
    |- genre
        |- _index.md [layout = "genre"]

I was able to generate in layout/books/list.html all books and covers with the following:

{{range where .Pages "Layout" "==" ""}}

<!-- cover -->
{{$cover := (.Site.GetPage "/books/img/covers").Resources}}
{{$cover := $cover.GetMatch (printf "%s.*" (anchorize .Title))}}
{{with $cover}}
  {{.RelPermalink}}
{{end}}

<!-- content -->
{{.Title}}
{{.Description}}
{{end}}

With the new Hugo version, this still works, but each nested index.md file of the books/img folder now shows up in list.html despite being headless = true.

{{range where .Pages "Layout" "==" ""}}
  {{.}}
{{end}}

Gives:

Page(/books/book1.md)
Page(/books/book2.md)
Page(/books/img/authors/index.md) <-- should not show up
Page(/books/img/covers/index.md) <-- should not show up
Page(/books/img/publishers/index.md) <-- should not show up

I’ve searched the docs and on here, but I can’t find what’s changed. How do I loop through my content files as before, and not show the headless .index.html files? Thanks.

You have stumbled upon a bug:

2 Likes