-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html
100 lines (85 loc) · 3.92 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
layout: blog
show_banner: true
redirect_from:
- /index.php/
---
<div class="uk-container-center uk-width-1-1 uk-width-medium-3-4">
{%- for post in paginator.posts -%}
<article class="uk-article">
<h2 class="uk-text-bold">{{ post.title }}</h2>
{%- if post.author or post.date -%}
<p class="uk-article-meta">Written{% if post.author %} by <strong>{% if post.author_url %}<a href="{{ post.author_url }}">{% endif %}{{ post.author }}{% if post.author_url %}</a>{% endif %}</strong>{% endif %}{% if post.date %} on {{ post.date | date: '%A, %B %-d, %Y' }}{% endif -%}</p>
{%- endif -%}
{{ post.excerpt }}
<a class="uk-button uk-button-mini uk-button-primary" href="{{ post.url }}">Read more »</a>
</article>
<hr class="uk-article-divider" />
{%- endfor -%}
<ul class="uk-pagination">
{%- assign max_buttons = 5 -%}
{%- assign max_buttons_sides = max_buttons | minus: 1 | divided_by: 2 -%}
{%- assign max_buttons_left = max_buttons_sides | floor -%}
{%- assign max_buttons_right = max_buttons_sides | ceil -%}
{%- assign start = paginator.page | minus: max_buttons_left -%}
{%- if start < 1 -%}{%- assign start = 1 -%}{%- endif -%}
{%- assign end = paginator.page | plus: max_buttons_right -%}
{%- if end > paginator.total_pages -%}{%- assign end = paginator.total_pages -%}{%- endif -%}
{%- assign current_start_diff = paginator.page | minus: start -%}
{%- assign current_end_diff = end | minus: paginator.page -%}
{%- if current_start_diff < max_buttons_left -%}
{%- assign start = 1 -%}
{%- assign end = max_buttons -%}
{%- if end > paginator.total_pages -%}{%- assign end = paginator.total_pages -%}{%- endif -%}
{%- endif -%}
{%- if current_end_diff < max_buttons_right -%}
{%- assign start = paginator.total_pages | plus: 1 | minus: max_buttons -%}
{%- if start < 1 -%}{%- assign start = 1 -%}{%- endif -%}
{%- assign end = paginator.total_pages -%}
{%- endif -%}
<li>
{%- if paginator.previous_page -%}
<a href="/"><i class="uk-icon-angle-double-left"></i></a>
{%- else -%}
<span><i class="uk-icon-angle-double-left"></i></span>
{%- endif -%}
</li>
<li>
{%- if paginator.previous_page -%}
<a href="{{ paginator.previous_page_path }}"><i class="uk-icon-angle-left"></i></a>
{%- else -%}
<span><i class="uk-icon-angle-left"></i></span>
{%- endif -%}
</li>
<li></li>
{%- for page in (start..end) -%}
{%- if page == paginator.page -%}
{%- capture link -%}<span>{{ page }}</span>{%- endcapture -%}
{%- elsif page == 1 -%}
{%- capture link -%}<a href="/">{{ page }}</a>{%- endcapture -%}
{%- else -%}
{%- capture link -%}<a href="{{ site.paginate_path | replace: ':num', page }}">{{ page }}</a>{%- endcapture -%}
{%- endif -%}
<li{% if page == paginator.page %} class="uk-active"{% endif %}>
{{ link }}
</li>
{%- endfor -%}
<li></li>
<li>
{%- if paginator.next_page -%}
<a href="{{ paginator.next_page_path }}"><i class="uk-icon-angle-right"></i></a>
{%- else -%}
<span><i class="uk-icon-angle-right"></i></span>
{%- endif -%}
</li>
<li>
{%- if paginator.next_page -%}
<a href="{{ site.paginate_path | replace: ':num', paginator.total_pages }}">
<i class="uk-icon-angle-double-right"></i>
</a>
{%- else -%}
<span><i class="uk-icon-angle-double-right"></i></span>
{%- endif -%}
</li>
</ul>
</div>