I am using Jekyll to build a blog, I managed to successfully implement a Next and Previous links on my layouts pages (using this answer). I've added several categories (using this answer) and each page iterates through the proper categories displaying only what I want them to.
My only problem now is that Previous and Next buttons still iterate through all the posts regardless of what category they are in.
This is the code I used for the Next and Previous links on the bottom of the layout:
{% if page.previous %}
<span class="previous-link">
<a rel="prev" href="{{ page.previous.url }}">Previous Entry</a>
</span>
{% endif %}
{% if page.next %}
<span class="next-link">
<a rel="next" href="{{ page.next.url }}">Next Entry</a>
</span>
{% endif %}
Is there a way to make the Next and Previous buttons go to the next or previous post in the current posts' category?