Created
April 16, 2016 11:56
-
-
Save spazione/165e80adefd5cf470f0abe3d027edf6a to your computer and use it in GitHub Desktop.
page nav
This file contains 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
{% if page.paginator %} | |
{% assign paginator = page.paginator %} | |
{% endif %} | |
{% for post in paginator.posts %} | |
{% include blog/entry.html %} | |
{% endfor %} | |
{% if paginator.total_pages > 1 %} | |
<ul class="pagination"> | |
{% if paginator.previous_page %} | |
<li class="page-item"><a class="page-link" aria-label="Previous" href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a></li> | |
{% else %} | |
<li class="page-item disabled"><span class="page-link">« Prev</span></li> | |
{% endif %} | |
{% for page in (1..paginator.total_pages) %} | |
{% if page == paginator.page %} | |
<li class="page-item active"><a class="page-link" href="#">{{ page }}</a></li> | |
{% elsif page == 1 %} | |
<li class="page-item"><a class="page-link" href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a></li> | |
{% else %} | |
<li class="page-item"><a class="page-link" href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a></li> | |
{% endif %} | |
{% endfor %} | |
{% if paginator.next_page %} | |
<li class="page-item"><a class="page-link" href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next »</a></li> | |
{% else %} | |
<li class="page-item disabled"><span class="page-link">Next »</span></li> | |
{% endif %} | |
</ul> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment