Pagination is not working after updating my hugo

My computer recently crashed and I had to install a new version of Hugo.
On my website under the content folder I have a folder called sections that has 4 files in it:
about.md, blog.md, contact.md, and search.md
Here is my website
as you can see all those 4 sections are 4 links at the bottom of the page.

Screen Shot 2020-11-15 at 10.01.39 PM

Now that I have updated my Hugo here is what I see:

Screen Shot 2020-11-15 at 10.03.14 PM

I looked at my index.html under layouts and it has these lines:

    <nav>
      <ul>
        {{ range (where .Data.Pages.ByWeight "Section" "sections")  }}
          <li>{{ if isset .Params "link" }}<a href="{{ index .Params "link" }}"{{else}}<a href="#{{ with .File }}{{ .TranslationBaseName }}{{ end }}"{{end}}>{{ if .Param "menuname" }}{{ .Param "menuname" }}{{ else }}{{ .Title }}{{ end }}</a></li>
        {{ end }}
      </ul>
    </nav>

also:

  <div id="main">
    {{ range (where .Data.Pages "Section" "sections") }}
      {{ .Render "onepagestyle" }}
    {{ end }}
  </div>

I really appreciate any help on this. Why I am not setting all the four links under sections folder on my main website page?

We need to see what’s inside the sections folder and the frontmatter of those files to have an opinion. I don’t remember any issue like that before, where a navigation “hops” up one level. Please post a link to your repository.

@davidsneighbour thanks again for your help, that is very kind of you. Inside the sections folder there are just 4 files as I explained:

Screen Shot 2020-11-15 at 11.21.17 PM

here is the about.md frontmatter:

---
title: "About"
---

here is the contact.md frontmatter:

---
title: "Contact"
---

here is the search.md frontmatter:

---
title: "Search"
---

and here is the blog.md frontmatter:

+++
title = "Blog"
weight = 20
draft = false
+++

I appreciate any help on this issue.

You probably need to replace this with something like

    {{ range (where site.RegularPages "Section" "sections") }}

See the differences here: https://gohugo.io/variables/page/#pages-compared-to-sitepages

2 Likes

@pointyfar thanks so much for your help. After replacing .Data.Pages in both lines of ‘index.html’, now I can see all 4 links :slight_smile:
Now the question is, why this code was working before but not working now? Has something changed on the new version of Hugo?
Thanks again, I really appreciate your help it was great.

Yes, there were some changes around .Pages around version 0.57 or so: https://gohugo.io/news/0.57.0-relnotes/

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