My site not working anymore after moving to 0.64.1

I installed updated Hugo to 0.64.1 from 0.5x. I am sorry I do not remember the exact version of my original Hugo installation. I only remember that the second version number started with 5.

After that, my home page basically displays nothing because the variables I use return empty arrays. One case is the following:

{{ $pages := .Pages | complement (where .Pages "Params.nocontent" true) }}
{{ $pinned_pages := where $pages "Params.pinned" true }}
{{ $sorted_pinned_pages := $pinned_pages.ByDate.Reverse }}

A bit of context… In my pages I use, in the header, some custom parameters. Some are: nocontent and pinned. Not all pages have those, but some have and they accept a boolean value.
Before updating, $sorted_pinned_pages used to have a value. Now it is an empty array. Also $pinned_pages happens to be empty, which explains why the previous one is too. However $pages is not empty.

Has anything changed that might explain this?


Related

I understand that without the content you cannot really understand what is going on here. It might be useful for me, in order to give more info, to see what the different variables are actually holding. I have posted a question on StackOverflow about how to print a variable value.

If you tell me how to do that, I can maybe understand what is going wrong here.

May be try .Params instead of Params and may be .Site.RegularPages

1 Like

There have been some changes with what gets included in.Pages when called from the homepage. Have a read here: https://gohugo.io/variables/site/#site-pages

Template debugging: https://gohugo.io/templates/template-debugging/

2 Likes

I have tried using function printf but I get this:

  • &hugolib.pageState{pageOutputs:*hugolib.pageOutput{(*hugolib.pageOutput)(0xc000afa120), (*hugolib.pageOutput)(0xc000afa240)}, pageOutput:(*hugolib.pageOutput)(0xc000afa120), pageCommon:(*hugolib.pageCommon)(0xc0006da500)} &hugolib.pageState{pageOutputs:*hugolib.pageOutput{(*hugolib.pageOutput)(0xc000afb9e0), (*hugolib.pageOutput)(0xc000afbb00)}, pageOutput:(*hugolib.pageOutput)(0xc000afb9e0), pageCommon:(*hugolib.pageCommon)(0xc0006daa00)} &hugolib.pageState{pageOutputs:*hugolib.pageOutput{(*hugolib.pageOutput)(0xc000b485a0), (*hugolib.pageOutput)(0xc000b486c0)}, pageOutput:(*hugolib.pageOutput)(0xc000b485a0), pageCommon:(*hugolib.pageCommon)(0xc0006daf00)}

When I use this code:

{{ range $pages }}
  {{ printf "%#v" . }}
{{ end }}

Is there some kind of why to stringify the object?

I was using .Pages before, but things have apparently changed and .Site.RegularPages now is the place where I should look!