2016-03-09 21:11:34 +01:00
|
|
|
{% include base_path %}
|
|
|
|
|
|
|
|
{% if paginator.total_pages > 1 %}
|
|
|
|
<nav class="pagination">
|
|
|
|
<ul>
|
|
|
|
{% comment %} Link for previous page {% endcomment %}
|
|
|
|
{% if paginator.previous_page %}
|
|
|
|
{% if paginator.previous_page == 1 %}
|
2016-03-09 22:33:27 +01:00
|
|
|
<li><a href="{{ base_path }}/" class="btn">{{ site.data.ui-text.locale[site.locale].pagination_previous }}</a></li>
|
2016-03-09 21:11:34 +01:00
|
|
|
{% else %}
|
2016-03-09 22:33:27 +01:00
|
|
|
<li><a href="{{ base_path }}/page{{ paginator.previous_page }}/" class="btn">{{ site.data.ui-text.locale[site.locale].pagination_previous }}</a></li>
|
2016-03-09 21:11:34 +01:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% comment %}First page{% endcomment %}
|
|
|
|
{% if paginator.page == 1 %}
|
|
|
|
<li><strong class="current">1</strong></li>
|
|
|
|
{% else %}
|
|
|
|
<li><a href="{{ base_path }}/">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>…</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 %}
|
|
|
|
|
|
|
|
{% for index in (page_start..page_end) %}
|
|
|
|
{% if index == paginator.page %}
|
|
|
|
<li><strong class="current">{{ index }}</strong></li>
|
|
|
|
{% else %}
|
2016-03-09 22:33:27 +01:00
|
|
|
{% comment %}Distance from current page and this link{% endcomment %}
|
2016-03-09 21:11:34 +01:00
|
|
|
{% assign dist = paginator.page | minus: index %}
|
|
|
|
{% if dist < 0 %}
|
2016-03-09 22:33:27 +01:00
|
|
|
{% comment %}Distance must be a positive value{% endcomment %}
|
2016-03-09 21:11:34 +01:00
|
|
|
{% assign dist = 0 | minus: dist %}
|
|
|
|
{% endif %}
|
|
|
|
<li><a href="{{ base_path }}/page{{ index }}/">{{ index }}</a></li>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% comment %}Ellipsis for truncated links{% endcomment %}
|
|
|
|
{% if pages_to_end > 3 %}
|
|
|
|
<li>…</li>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if paginator.page == paginator.total_pages %}
|
|
|
|
<li><strong class="current">{{ paginator.page }}</strong></li>
|
|
|
|
{% else %}
|
|
|
|
<li><a href="{{ base_path }}/page{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% comment %}Link next page{% endcomment %}
|
|
|
|
{% if paginator.next_page %}
|
2016-03-09 22:33:27 +01:00
|
|
|
<li><a href="{{ base_path }}/page{{ paginator.next_page }}/" class="btn">{{ site.data.ui-text.locale[site.locale].pagination_next }}</a></li>
|
2016-03-09 21:11:34 +01:00
|
|
|
{% endif %}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
{% endif %}
|