A footer showing the user the next and previous posts on a blog or other series of content seems like a pretty common requirement, and it’s one that many blog themes come with out of the box.
When trying to do this in Jekyll, searching the documentation took me to the page about pagination and explained how to add next/previous links to a paginator, but that wasn’t what I was after.
I stumbled across what I was looking for on the Variables page where I discovered each page has the variables
It might not be immediately obvious to newcomers that these variables are packed with quite a bit of information – they don’t just house the post name.
As a result, using them to construct a previous/next footer is really simple. In your post layout template, you can just do something like:
The end result
See below this post for the real, live implementation!