|
1 | 1 | {% if paginator.total_pages > 1 %}
|
2 |
| -<nav class="pagination"> |
3 |
| - {% assign paginate_path_last = site.paginate_path | split: '/' | last %} |
4 |
| - {% assign first_page_path = paginator.first_page_path | default: site.paginate_path | replace: paginate_path_last, '' | replace: '//', '/' | relative_url %} |
5 |
| - <ul> |
6 |
| - {% comment %} Link for previous page {% endcomment %} |
7 |
| - {% if paginator.previous_page %} |
8 |
| - {% if paginator.previous_page == 1 %} |
9 |
| - <li><a href="{{ first_page_path }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li> |
10 |
| - {% else %} |
11 |
| - <li><a href="{{ site.paginate_path | replace: ':num', paginator.previous_page | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li> |
12 |
| - {% endif %} |
13 |
| - {% else %} |
14 |
| - <li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</span></a></li> |
15 |
| - {% endif %} |
16 |
| - |
17 |
| - {% comment %} First page {% endcomment %} |
18 |
| - {% if paginator.page == 1 %} |
19 |
| - <li><a href="#" class="disabled current">1</a></li> |
20 |
| - {% else %} |
21 |
| - <li><a href="{{ first_page_path }}">1</a></li> |
22 |
| - {% endif %} |
23 |
| - |
24 |
| - {% assign page_start = 2 %} |
25 |
| - {% if paginator.page > 4 %} |
26 |
| - {% assign page_start = paginator.page | minus: 2 %} |
27 |
| - {% comment %} Ellipsis for truncated links {% endcomment %} |
28 |
| - <li><a href="#" class="disabled">…</a></li> |
29 |
| - {% endif %} |
30 |
| - |
31 |
| - {% assign page_end = paginator.total_pages | minus: 1 %} |
32 |
| - {% assign pages_to_end = paginator.total_pages | minus: paginator.page %} |
33 |
| - {% if pages_to_end > 4 %} |
34 |
| - {% assign page_end = paginator.page | plus: 2 %} |
35 |
| - {% endif %} |
36 |
| - |
37 |
| - {% for index in (page_start..page_end) %} |
38 |
| - {% if index == paginator.page %} |
39 |
| - <li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | relative_url }}" class="disabled current">{{ index }}</a></li> |
40 |
| - {% else %} |
41 |
| - {% comment %} Distance from current page and this link {% endcomment %} |
42 |
| - {% assign dist = paginator.page | minus: index %} |
43 |
| - {% if dist < 0 %} |
44 |
| - {% comment %} Distance must be a positive value {% endcomment %} |
45 |
| - {% assign dist = 0 | minus: dist %} |
46 |
| - {% endif %} |
47 |
| - <li><a href="{{ site.paginate_path | replace: ':num', index | relative_url }}">{{ index }}</a></li> |
48 |
| - {% endif %} |
49 |
| - {% endfor %} |
50 |
| - |
51 |
| - {% comment %} Ellipsis for truncated links {% endcomment %} |
52 |
| - {% if pages_to_end > 3 %} |
53 |
| - <li><a href="#" class="disabled">…</a></li> |
54 |
| - {% endif %} |
55 |
| - |
56 |
| - {% if paginator.page == paginator.total_pages %} |
57 |
| - <li><a href="#" class="disabled current">{{ paginator.page }}</a></li> |
58 |
| - {% else %} |
59 |
| - <li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | relative_url }}">{{ paginator.total_pages }}</a></li> |
60 |
| - {% endif %} |
61 |
| - |
62 |
| - {% comment %} Link next page {% endcomment %} |
63 |
| - {% if paginator.next_page %} |
64 |
| - <li><a href="{{ site.paginate_path | replace: ':num', paginator.next_page | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li> |
65 |
| - {% else %} |
66 |
| - <li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li> |
67 |
| - {% endif %} |
68 |
| - </ul> |
69 |
| -</nav> |
| 2 | + {% if site.paginate %} |
| 3 | + {% include paginator-v1.html %} |
| 4 | + {% elsif site.pagination.enabled %} |
| 5 | + {% include paginator-v2.html %} |
| 6 | + {% endif %} |
70 | 7 | {% endif %}
|
0 commit comments