I am attempting to create pagination in Jekyll under the path '/notes/'.
In my _config.yml
, I have:
paginate: 2
paginate_path: "/notes/:num/"
In my /notes/index.html
, I have:
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path }}" class="previous section link">Previous</a>
{% else %}
<span class="previous section link">Previous</span>
{% endif %}
<span class="page_number section">{{ paginator.page }} / {{ paginator.total_pages }}</span>
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path }}" class="next section link">Next</a>
{% else %}
<span class="next section link">Next</span>
{% endif %}
</div>
When I load http://localhost:4000/notes
, I see that the 'Previous' link is not linking to /notes/2
, but instead it simply links to /notes/
, the page that I am already on. Additionally, when looking in the generated _site
folder, I see that /notes/2
has not been created, despite having more than two posts created.
So, I suppose my question is, how can I fix this and get jekyll to paginate properly?