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?