Must be Theme Changing day, as I’ve made one last change that’s been on my wish-list for a while: the ability to page within the post screen themselves. This allows one to page through the entries without having to go back to the Archive section.
Here’s the template to do that, which uses Tiny Theme’s micro-hooks:
<!-- layouts/partials/microhook-after-post.html -->
<nav class="paging">
<ul>
{{ if .PrevInSection }}
{{ if eq .PrevInSection.Params.trip .Params.trip }}
<li class="previous">
<a href="{{.PrevInSection.Permalink}}">❮ Previous Post</a>
</li>
{{ end }}
{{ end }}
{{ if .NextInSection }}
{{ if eq .NextInSection.Params.trip .Params.trip }}
<li class="next">
<a href="{{.NextInSection.Permalink}}">Next Post ❯</a>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
I also added a bit of CSS to space the links across the page:
nav.paging ul {
display: flex;
justify-content: space-between;
}
The only thing I’m unsure about is whether “Next Post” should appear on the right. It feels a little like it actually should be on the left, since the “Older Post” link in the entry list has an arrow pointing to the right, suggesting that time goes from right to left. Maybe if I removed the arrow from the “Older Post” link, the direction of time will become ambiguous and I can leave the post paging buttons where they are. Ah well, no time for that now. 😉