_includes/paginator.html (55 lines of code) (raw):

{% if paginator.total_pages > 1 %} <nav class="pagination"> <ul> {% comment %} Link for previous page {% endcomment %} {% if paginator.previous_page %} {% if paginator.previous_page == 1 %} <li><a href="{{ paginator.first_page_path | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li> {% else %} <li><a href="{{ paginator.previous_page_path | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li> {% endif %} {% else %} <li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</span></a></li> {% endif %} {% comment %} First page {% endcomment %} {% if paginator.page > 4 %} <li><a href="{{ paginator.first_page_path | replace: '//', '/' | relative_url }}">1</a></li> {% endif %} {% assign page_start = 2 %} {% if paginator.page > 4 %} {% assign page_start = paginator.page | minus: 2 %} {% comment %} Ellipsis for truncated links {% endcomment %} <li><a href="#" class="disabled">&hellip;</a></li> {% endif %} {% assign page_end = paginator.total_pages | minus: 1 %} {% assign pages_to_end = paginator.total_pages | minus: paginator.page %} {% if pages_to_end > 4 %} {% assign page_end = paginator.page | plus: 2 %} {% endif %} {% if paginator.page_trail %} {% for trail in paginator.page_trail %} {% if page.url == trail.path %} <li><a href="{{ trail.path | replace: '//', '/' | relative_url }}" class="disabled current">{{ trail.num }}</a></li> {% else %} <li><a href="{{ trail.path | replace: '//', '/' | relative_url }}">{{ trail.num }}</a></li> {% endif %} {% endfor %} {% endif %} {% comment %} Ellipsis for truncated links {% endcomment %} {% if pages_to_end > 3 %} <li><a href="#" class="disabled">&hellip;</a></li> {% endif %} {% comment %} Link to last page {% endcomment %} {% assign stop = paginator.total_pages | minus: 2 %} {% if paginator.page < stop %} <li><a href="{{ paginator.last_page_path | replace: '//', '/' | relative_url }}">{{ paginator.total_pages }}</a></li> {% endif %} {% comment %} Link next page {% endcomment %} {% if paginator.next_page %} <li><a href="{{ paginator.next_page_path | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li> {% else %} <li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li> {% endif %} </ul> </nav> {% endif %}