1+ {% if paginator.total_pages> 1 %}
2+ < div class ="pagination ">
3+ < ul class ="inline-list ">
4+ {% comment %} Link for previous page {% endcomment %}
5+ {% if paginator.previous_page %}
6+ {% if paginator.previous_page == 1 %}
7+ < li > < a href ="{{ site.url }} "class ="btn "> Previous</ a > </ li >
8+ {% else %}
9+ < li > < a href ="{{ site.url }}/page{{ paginator.previous_page }}/ "class ="btn "> Previous</ a > </ li >
10+ {% endif %}
11+ {% endif %}
12+
13+ {% comment %} First page {% endcomment %}
14+ {% if paginator.page == 1 %}
15+ < li > < strong class ="current-page "> 1</ strong > </ li >
16+ {% else %}
17+ < li > < a href ="{{ site.url }} "> 1</ a > </ li >
18+ {% endif %}
19+
20+ {% assign page_start = 2 %}
21+ {% if paginator.page> 4 %}
22+ {% assign page_start = paginator.page | minus: 2 %}
23+ {% comment %} Ellipsis for truncated links {% endcomment %}
24+ < li > …</ li >
25+ {% endif %}
26+
27+ {% assign page_end = paginator.total_pages | minus: 1 %}
28+ {% assign pages_to_end = paginator.total_pages | minus: paginator.page %}
29+ {% if pages_to_end> 4 %}
30+ {% assign page_end = paginator.page | plus: 2 %}
31+ {% endif %}
32+
33+ {% for index in (page_start..page_end) %}
34+ {% if index == paginator.page %}
35+ < li > < strong class ="current-page "> {{index}}</ strong > </ li >
36+ {% else %}
37+ {% comment %} Distance from current page and this link {% endcomment %}
38+ {% assign dist = paginator.page | minus: index %}
39+ {% if dist< 0 %}
40+ {% comment %} Distance must be a positive value {% endcomment %}
41+ {% assign dist =0 | minus: dist %}
42+ {% endif %}
43+ < li > < a href ="{{ site.url }}/page{{ index }}/ "> {{index}}</ a > </ li >
44+ {% endif %}
45+ {% endfor %}
46+
47+ {% comment %} Ellipsis for truncated links {% endcomment %}
48+ {% if pages_to_end> 3 %}
49+ < li > …</ li >
50+ {% endif %}
51+
52+ {% if paginator.page == paginator.total_pages %}
53+ < li > < strong class ="current-page "> {{ paginator.page }}</ strong > </ li >
54+ {% else %}
55+ < li > < a href ="{{ site.url }}/page{{ paginator.total_pages }}/ "> {{ paginator.total_pages }}</ a > </ li >
56+ {% endif %}
57+
58+ {% comment %}
59+ Link next page
60+ {% endcomment %}
61+ {% if paginator.next_page %}
62+ < li > < a href ="{{ site.url }}/page{{ paginator.next_page }}/ "class ="btn "> Next</ a > </ li >
63+ {% endif %}
64+ </ ul >
65+ </ div >
66+ {% endif %}