Problem with RegularPages

I have a blog using the no longer supported theme theme-hugo-foundation6. I have a repository of the theme as last updated here GitHub - billthefarmer/theme-hugo-foundation6. The sources for the blog are here blog/blog at master · billthefarmer/blog · GitHub. the blog is here Bill Farmer. I have fixed a few minor problems with the theme as they were flagged up but the changes introduced in Hugo 0.57 have broken the main page and I can’t work out how to fix it. The baseof.html file contains:

{{ block "main" . }} {{ end }}
{{ partial "sidebar.html" . }}

The list.html file contains:

{{ define "main" }}

{{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
{{ range $paginator.Pages }}
  {{ .Render "summary" }}
{{ end }}

This works fine for category pages, but not the main page. I realise I should be using site.RegularPages or .Site.RegularPages but I can’t work out where or how.

Homepage’s .Pages only holds root sections, so try this:

{{ $pages := .Pages }}
{{ if .IsHome }}
  {{ $pages = site.RegularPages }}
{{ end }}
{{ $paginator := .Paginate (where $pages "Type" "post") }}
1 Like

Thank you, that works fine

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