Error in Previous Next links partial

Hello I am trying to do the same thing as the person who posted this:

I was happy to see that jmooring offers a great solution:

I am not a very capable programmer nor git user but I was able to download the git repo and add the files:

  1. layouts/_partials/build-page-collection.html
  2. layouts/_partials/nav-prev-next-guides.html

to my theme.

Hugo reports:

execute of template failed: template: _partials/nav-prev-next-guides.html:5:15: executing “_partials/nav-prev-next-guides.html” at <$pc.Reverse.Prev>: can’t evaluate field Reverse in type interface {}


<nav class="nav-inline">
  <ol>
    {{ with $pc.Reverse.Prev . }}
      <li><a href="{{ .RelPermalink }}">Previous</a></li>
    {{ end }}

(Sorry, I pasted the code in once and got 2 code blocks and do not see way to delete the top one)

Any help on this would be much appreciated.

Thanks ahead of time for any assistance.

What’s your Hugo version?

Requires v0.146.7 or later.

@kijana Thanks for your reply.

Hugo version is hugo v0.152.2+extended linux/amd64 BuildDate=2025-12-14T00:00:00+00:00 VendorInfo=Fedora:0.152.2-1.fc43

Share your code Requesting Help

I did not develop the code - as I indicated above the files are discussed and provided in:

And the specific files I am using are:

  1. layouts/_partials/build-page-collection.html

  2. layouts/_partials/nav-prev-next-guides.html

How this code behaves is highly dependent on the rest of your site, how you call the partial, etc.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

@jmooring Thank you very much for your reply.

I had read thru the Requesting Help section but I did not provide a link to the source code of my repo because I am a little embarrassed to say that unfortunately I do not know git.

I am a retired engineer with limited IT skills although I hope to learn git in future. For my purposes at this time, I rev things in a different way.

I tried to debug this by first of all installing a fresh copy of Hugo and making only the minimal changes to it to implement the Previous and Next links:

  • I installed hugo v0.152.2+extended linux/amd64 BuildDate=2025-12-14T00:00:00+00:00 VendorInfo=Fedora:0.152.2-1.fc43
  • I installed a theme using “hugo new theme”
  • I enabled that theme in hugo.toml
  • Using git clone --single-branch -b hugo-forum-topic-54465 GitHub - jmooring/hugo-testing: Hugo test sites related to Forum topics or GitHub issues hugo-forum-topic-54465, I got the files:
  • layouts/_partials/build-page-collection.html
  • layouts/_partials/nav-prev-next-guides.html
  • And placed them in site (not theme) layouts/_partials/
  • In page.html in /theme/layouts/ I added:
  • {{ partial “nav-prev-next-guides” }}

I then restarted Hugo and the same error occurred:

execute of template failed: template: _partials/nav-prev-next-guides.html:5:15: executing “_partials/nav-prev-next-guides.html” at <$pc.Reverse.Prev>: can’t evaluate field Reverse in type interface {}

Is there maybe some additional code I need to add to support the evaluation of field Reverse ?

You aren’t passing any context to the partial template. In the repository you cloned, look at layouts/guides/page.html (line 5).

@jmooring I am sorry I missed that.

I will make changes to my site.

Thanks very much for your help.