So what we see here is the effect of .PrevInSection
and .NextInSection
. Let’s see what Hugo’s official documentation has to say about .PrevInSection
:
Points down to the previous regular page below the same top level section (e.g.
/blog
). Pages are sorted by Hugo’s default sort. Example:{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}
. Calling.PrevInSection
from the last page returnsnil
.
Okay, I admit, that’s a bit of a mouthful. In your case, and I guess for everyone hosted on Micro.blog, the top-level section is the year the post was published. So in my basic example posted above, the next and previous links will always be scoped to the year.
When you arrive at the first post of a year, you won’t be able to go further back. In the same way, there won’t be a next post link when you arrive at the last post of a year.
To fix this, you could use .Next
and .Prev
instead. But that may have other unwanted side effects. Feel free to try it out, though. Just change every instance of .PrevInSection
to .Prev
and .NextInSection
to .Next
.
Another solution would be to order posts into a common top-level section (like /blog
). I don’t know enough to tell you if that’s possible on a hosted Micro.blog, though. Maybe @manton can chime in here?
A third solution is to build upon my basic version to support navigation between sections (years).