Hugo

Missing posts in subdirs with hugo >= 0.57

After upgrading 0.54 -> 0.59.3 all pages in subdirs stopped showing up in lists or rendering as pages.

I bisected and found that the change was in 0.57.

All pages under articles/ , journal/ etc are missing.

I read through the release notes and tried a few things but it’s not clear to me what’s noncompliant.

So, the breaking change was introduced in 0.57, then partly rolled back in 0.57.1… Then introduced again in 0.58.

The short story is:

  • .Pages now works the same on all levels, including the home page. It goes down one level and includes both regular pages and sections.
  • We added a .RegularPages the patch some of the confusion
  • So, when you want to list “all pages” or something on the home page, you need to use site.RegularPages.

This change was unfortunate, and I probably waited to long before doing it – fearing the breakage. But in the end I closed my eyes and did it. All for a greater cause.

I read about that change in other threads, but it doesn’t seem to explain

(deployed develop branch with hugo 0.59.1 for inspection)

Remove this line.

1 Like

Thanks, the pages in subdirs are picked up now!

Why does that line leads to pages in subdirectories not being picked up? I guess directories are “categories”? Why is it even an option to not recurse into subdirs, what is the use-case?

Also, what was the breaking change that made this happen?

The “why” is because unintended usage leads to unintended consequences.

This is more a case of “it was failing to fail” previously, as category = "" is not the correct way to disable taxonomies.

*not a Hugo dev though.

That’s happening because hugo change their strategy in v0.58.0 to higher, for showing subdirs post use {{ range .Site.RegularPages}} instead of {{ range .Data.Pages }}

Would it make sense to update the documentation with this in mind (https://gohugo.io/templates/lists/)? I wasn’t having this problem last week (v0.59.0), so this was a bit of a surprise. Not sure why I didn’t see it before.

Hi @themefisher, @jacobproffer,

To be clear: for the specific case of @edrex’s site, it was breaking because of the misconfigured taxonomy:

category = ""

It should have been breaking pre-0.57. Some of the changes to Hugo since is what enabled it to break, as it should have been doing all along. In fact, removing the config line makes the site work again. No other changes were required, for this specific case.

The different .Pages variations are documented here: https://gohugo.io/variables/site/#site-pages-compared-to-pages

If you are having problems unrelated to a misconfigured taxonomy, you are welcome to open your own topic here.