-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_pagination_general.twig
28 lines (26 loc) · 1.17 KB
/
_pagination_general.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{% set link = pager.makelink() %}
{% spaceless %}
{% if pager.totalpages > 1 %}
<nav class="nav-pagination {{class}}">
<ul class="pagination">
{# 'first' and 'prev' #}
{% if pager.current > 1 and class!="narrow" %}
<li class="page-item"><a class="page-link" href="{{link}}{{pager.current-1}}" rel="noindex, follow">‹</a></li>
{% endif %}
{% if pager.current > surr+1 %}
<li class="page-item"><a class="page-link" href="{{link}}{{1}}">«</a></li>
{% endif %}
{% for i in max(1, pager.current-surr)..min(pager.current+surr, pager.totalpages) %}
<li class="page-item{% if i==pager.current %} active{%endif%}"><a class="page-link" href="{{link}}{{i}}" {% if i != 1 %}rel="noindex, follow"{% endif %}>{{i}}</a></li>
{% endfor %}
{# 'next' and 'last' #}
{% if pager.current < pager.totalpages-surr %}
<li class="page-item"><a class="page-link" href="{{link}}{{pager.totalpages}}" rel="noindex, follow">»</a></li>
{% endif %}
{% if pager.current < pager.totalpages and class!="narrow" %}
<li class="page-item"><a class="page-link" href="{{link}}{{pager.current+1}}" rel="noindex, follow">›</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endspaceless %}