Last active
May 26, 2022 02:39
-
-
Save kylehotchkiss/56657b0361993aa26be319deb20eca4e to your computer and use it in GitHub Desktop.
Bootstrap 4 / Jekyll Pagination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="section-pagination text-center"> | |
<nav class="d-table mx-auto"> | |
<ul class="pagination"> | |
{% if paginator.previous_page %} | |
{% if paginator.previous_page == 1 %} | |
<li class="page-item"><a class="page-link" href="/blog">«</a></a> | |
{% else %} | |
<li class="page-item"><a class="page-link" href="/blog/page/{{ paginator.previous_page }}">«</a></li> | |
{% endif %} | |
{% else %} | |
<li class="page-item disabled"><a class="page-link" href="#">«</a></li> | |
{% endif %} | |
{% for i in (1..paginator.total_pages) %} | |
{% if i == 1 %} | |
{% if paginator.page == i %} | |
<li class="page-item active"><a class="page-link" href="#">{{ i }}</a></li> | |
{% else %} | |
<li class="page-item"><a class="page-link" href="/">{{ i }}</a></li> | |
{% endif %} | |
{% else %} | |
{% if paginator.page == i %} | |
<li class="page-item active"><a class="page-link" href="#">{{ i }}</a></li> | |
{% else %} | |
<li class="page-item"><a class="page-link" href="/blog/page/{{ i }}">{{ i }}</a></li> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% if paginator.next_page %} | |
<li class="page-item"><a class="page-link" href="/blog/page/{{ paginator.next_page }}">»</a></li> | |
{% else %} | |
<li class="page-item disabled"><a class="page-link" href="#">»</a></li> | |
{% endif %} | |
</ul> | |
</nav> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment