blob: 659ea873a947d97002444cbef3a3c7f5daaff184 (
plain) (
blame)
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
29
30
31
32
33
34
35
36
|
{% comment %}
Page links, inspired by the example at the bottom of
https://jekyllrb.com/docs/pagination/.
{% endcomment %}
{% if site.posts.size != 0 %}
{% comment %}
Link to page 1 is tricky. If site.paginate_path is used, then we cannot
simply use /. This is a silly attempt to get the proper page 1 link.
{% endcomment %}
{% if paginator.page == 1 %}
{% assign page1_url = page.url %}
{% else %}
{% assign page1_url = page.url | split: '/' | pop | join: '/' | append: '/' %}
{% endif %}
<ul class="pagination">
{% if paginator.previous_page %}
<li><a href="{{ site.baseurl }}{{ paginator.previous_page_path }}"><span class="glyphicon glyphicon-chevron-left"></span> Prev</a></li>
{% else %}
<li class="disabled"><a href="#"><span class="glyphicon glyphicon-chevron-left"></span> Prev</a></li>
{% endif %}
{% for page_number in (1..paginator.total_pages) %}
{% if page_number == paginator.page %}
<li class="active"><a href="#">{{ page_number }}</a></li>
{% elsif page_number == 1 %}
<li><a href="{{ site.baseurl }}{{ page1_url }}">{{ page_number }}</a></li>
{% else %}
<li><a href="{{ site.baseurl }}{{ site.paginate_path | replace: ':num', page_number }}">{{ page_number }}</a></li>
{% endif %}
{% endfor %}
{% if paginator.next_page %}
<li><a href="{{ site.baseurl }}{{ paginator.next_page_path }}">Next <span class="glyphicon glyphicon-chevron-right"></span></a></li>
{% else %}
<li class="disabled"><a href="#">Next <span class="glyphicon glyphicon-chevron-right"></span></a></li>
{% endif %}
</ul>
{% endif %}
|