Skip to content

Instantly share code, notes, and snippets.

@robertbiswas
Created July 19, 2022 13:19
Show Gist options
  • Save robertbiswas/be731710007363a9205042eccc3791e6 to your computer and use it in GitHub Desktop.
Save robertbiswas/be731710007363a9205042eccc3791e6 to your computer and use it in GitHub Desktop.
{% if paginator.total_pages != 1 %}
<div class="row text-center text-caps">
<div class="col-md-8 col-md-offset-2">
<nav class="pagination" role="pagination">
<span class="page-number">Page {{ paginator.page }} of {{ paginator.total_pages }}</span>
{% if site.paginate_path != 'page:num'%}
{% assign paginate_url = site.paginate_path | remove:'/page:num' %}
{% if paginator.previous_page %}
{% if paginator.previous_page == 1 %}
<a class="newer-posts" href="{{ site.url }}/{{ paginate_url }}/" class="btn" title="Newer Posts">&larr; Newer Posts</a>
{% else %}
<a class="newer-posts" href="{{ site.url }}/{{ paginate_url }}/page{{ paginator.previous_page }}/" class="btn" title="Newer Posts">&larr; Newer Posts</a>
{% endif %}
{% endif %}
{% if paginator.next_page %}
<a class="older-posts" href="{{ site.url }}/{{ paginate_url }}/page{{ paginator.next_page }}/" class="btn" title="Older Posts">Older Posts &rarr;</a>
{% endif %}
{% else %}
{% if paginator.previous_page %}
{% if paginator.previous_page == 1 %}
<a class="newer-posts" href="{{ site.url }}/" class="btn" title="Newer Posts">&larr; Newer Posts</a>
{% else %}
<a class="newer-posts" href="{{ site.url }}/page{{ paginator.previous_page }}/" class="btn" title="Newer Posts">&larr; Newer Posts</a>
{% endif %}
{% endif %}
{% if paginator.next_page %}
<a class="older-posts" href="{{ site.url }}/page{{ paginator.next_page }}/" class="btn" title="Older Posts">Older Posts &rarr;</a>
</nav>
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment