Pages are not found after the upgrade

I am having an issue with the the template after the hugo update.
I have the following code:

...
{{ range first 5 .Data.Pages.ByWeight}} 
            {{if(eq "Home" .Page.Title )}}
                {{ range first 5 .Data.Pages.ByWeight}}     
                {{$partialPath := (print "widgets/" .Page.File.TranslationBaseName ".html" ) }} 
                {{ partial $partialPath .}} 
            {{end}} 
        {{end}} 
    {{ end }}
...

The code above finds a folder content/new-home with the following files in it:

  • _index.md
  • name-a.md
  • name-b.md
  • name-c.md
  • name-d.md

The file _index.md has the following code

---
Title: "Home"
weight: 1
---

All name-[X].md files have only frontmatter that looks something like that:

---
widget: blank
headless: true

# ... Put Your Section Options Here (title etc.) ...
title: ...
subtitle: ...
btnTitle: ...
btnLink: ...
imgUrl: ...
weight: 1 
---

Now, the problem here is that this works absolutely fine in the 0.122.0 version of hugo: it grabs all the name-[X].md files and looping through them sends them to the partials.
It doesn’t work in versions 0.123.0 and above (frankly, I only checked in 123 and 129).
I tried to debug it and I found that {{ .Pages }} under the first loop returns Pages(0) for the newer versions and Pages(4) for the 0.122.0.

I looked at the release notes but couldn’t really figure out what should have been changed since the upgrade. Can you help me here?

your code snippet uses .Data.Pages.ByWeight which leads to using taxonomies?

If I where you I would provide a minimal runnable repo.

according to the current docs: Front matter | Hugo

headless: if true this value sets the render and list build options to never , creating a headless bundle of page resources.

with that it might not be possible to list the pages from where you are.

Check out the build options mentioned - there you can set different values for list and render. maybe better on the index and cascade that down.

Thanks a lot!
After posting this I actually decided to update the files and change headless: true to false and it worked like a charm!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.