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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
{%- macro title_post(page, config) %}
<h1><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1>
{%- endmacro title_post %}
{%- macro meta_post(page, config) %}
<span{%- if config.extra.meta_post.size %} class="{{ config.extra.meta_post.size }}"{% endif %}>
{#- Author #}
{%- if page.taxonomies.authors and config.taxonomies %}
{%- for author in page.taxonomies.authors %}
{%- if author_flag %}, {% endif %}
<a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a>
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif page.extra.authors and config.extra.meta_post.author %}
{%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %}
{%- for author in page.extra.authors %}
{%- if author_flag %}, {% endif %} {{ author }}
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif config.extra.author and config.extra.meta_post.author %}
{%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {{ config.extra.author }}
{%- endif %}
{#- divider #}
{%- if config.extra.meta_post.author %}
{%- if config.extra.meta_post.readtime or config.extra.meta_post.date or config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}
{%- endif %}
{%- endif %}
{#- ReadTime #}
{%- if config.extra.meta_post.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_post.readstring | default(value="min") }}
{#- divider #}
{%- if config.extra.meta_post.date or config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %}
{#- Date #}
{%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %}
{%- if config.extra.date_locale %}
{%- if lang != config.default_language -%}
{%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%}
{%- else -%}
{%- set lang_locale = config.extra.date_locale -%}
{%- endif -%}
{{ page.date | date(format="%B %d, %Y", locale=lang_locale) }}
{%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %}
{#- divider #}
{%- if config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %}
{#- Categories #}
{%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %}
{#- Tags #}
{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span>
{%- endmacro meta_post %}
{%- macro title_index(page, config) %}
<h1>{% if config.extra.title_size_index %}<span class="{{ config.extra.title_size_index }}">{% endif %}<a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a>{% if config.extra.title_size_index %}</span>{% endif %}</h1>
{%- endmacro title_index %}
{%- macro meta_index(page, config) %}
<span{%- if config.extra.meta_index.size %} class="{{ config.extra.meta_index.size }}"{% endif %}>
{#- Author #}
{%- if page.taxonomies.authors and config.taxonomies %}
{%- for author in page.taxonomies.authors %}
{%- if author_flag %}, {% endif %}
<a href="{{ get_taxonomy_url(kind='authors', name=author, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a>
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif page.extra.authors and config.extra.meta_index.author %}
{%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %}
{%- for author in page.extra.authors %}
{%- if author_flag %}, {% endif %} {{ author }}
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif config.extra.author and config.extra.meta_index.author %}
{%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {{ config.extra.author }}
{%- endif %}
{#- divider #}
{%- if config.extra.meta_index.author %}
{%- if config.extra.meta_index.readtime or config.extra.meta_index.date or config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}
{%- endif %}
{%- endif %}
{#- ReadTime #}
{%- if config.extra.meta_index.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_index.readstring | default(value="min") }}
{#- divider #}
{%- if config.extra.meta_index.date or config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %}
{#- Date #}
{%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %}
{%- if config.extra.date_locale %}
{%- if lang != config.default_language -%}
{%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%}
{%- else -%}
{%- set lang_locale = config.extra.date_locale -%}
{%- endif -%}
{{ page.date | date(format="%B %d, %Y", locale=lang_locale) }}
{%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %}
{#- divider #}
{%- if config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %}
{#- Categories #}
{%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %}
{#- Tags #}
{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span>
{%- endmacro meta_index %}
{%- macro footer(page) %}
{%- if page.reading_time and page.reading_time > 2 %}
<p><b><a href="#">Back to top</a></b></p>
{%- endif %}
<nav><!-- prev/next page title. Keep for CSS selector even if empty -->
{% if page.lower or page.higher-%}
<div>
{% if page.lower -%}
<a href="{{ page.lower.permalink | safe }}">‹ {{ page.lower.title | truncate(length=100) }}</a>
{%- endif %}
</div>
<div>
{% if page.higher -%}
<a href="{{ page.higher.permalink | safe }}"> {{ page.higher.title | truncate(length=100) }} ›</a>
{%- endif %}
</div>
{%- endif %}
</nav>
{%- endmacro footer %}
{%- macro pagination(paginator, config)%}
{%- if paginator.number_pagers > 1 %}
{%- if paginator.number_pagers <= 5 %} {# 5 or less pager is simple, just display all 5 #}
{%- set start = 1 %}
{%- set end = paginator.number_pagers %}
{%- endif %}
{%- if paginator.number_pagers > 5 %}
{%- if paginator.current_index >= 3 %} {# Check if the first number will be 1 or not #}
{%- set start = paginator.current_index - 2 %} {# Set the start number #}
{%- if paginator.number_pagers - paginator.current_index < 2 %} {# the last two pages your no longer centered with equal pages start and end #}
{%- set difference = paginator.number_pagers - paginator.current_index %}
{%- set compensation = 1 - difference %}
{%- set start = paginator.current_index - 3 - compensation %} {# however many pages are missing on the end, add offset to start #}
{%- endif %}
{%- else %}
{%- set start = 1 %}
{%- endif %}
{%- if paginator.number_pagers >= paginator.current_index + 2 %} {# Check if the last page is beyond our range #}
{%- set end = paginator.current_index + 2 %} {# End is beyond our range so we can safely set it to our range #}
{%- if paginator.current_index <= 3 %} {# check offset start, if on page 1 or 2 then set the end to page 5 #}
{%- set end = 5 %}
{%- endif %}
{%- else %}
{%- set end = paginator.number_pagers %}
{%- endif %}
{%- endif %}
<nav>
{%- set icon_first=config.extra.icon_first | default(value="svgs svgh angll") -%}
{%- set icon_prev=config.extra.icon_prev | default(value="svgs svgh angl") -%}
{%- set icon_next=config.extra.icon_next | default(value="svgs svgh angr") -%}
{%- set icon_last=config.extra.icon_last | default(value="svgs svgh angrr") -%}
{%- if paginator.previous -%}
<a class="on outp" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="First Page">
{%- if icon_first -%}<i class="{{ icon_first }}" alt="First Page"></i>
{%- else -%}❰
{%- endif -%}
</a>
{%- else -%}
<span class="off outp">
{%- if icon_first -%}<i class="{{ icon_first }}" alt="First Page"></i>
{%- else -%}❰
{%- endif -%}
</span>
{%- endif -%}
{%- if paginator.previous -%}
<a class="on outp" href="{{ paginator.previous | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Previous Page">
{%- if icon_prev -%}<i class="{{ icon_prev }}" alt="Previous Page"></i>
{%- else -%}❬
{%- endif -%}
</a>
{%- else -%}
<span class="off outp">
{%- if icon_prev -%}<i class="{{ icon_prev }}" alt="Previous Page"></i>
{%- else -%}❬
{%- endif -%}
</span>
{%- endif -%}
{%- for i in range(start=start, end=end+1) -%}
{%- if i == paginator.current_index -%}
<a class="inp on cnav" href="#">{{i}}</a>
{%- elif i > 1 -%}
<a class="inp on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{i}}</a>
{%- else -%}
<a class="inp on" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ i }}</a>
{%- endif -%}
{%- endfor -%}
{%- if paginator.next -%}
<a class="on outp" href="{{ paginator.next | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Next Page">
{%- if icon_next -%}<i class="{{ icon_next }}" alt="Next Page"></i>
{%- else -%}❭
{%- endif -%}
</a>
{%- else -%}
<span class="off outp">
{%- if icon_next -%}<i class="{{ icon_next }}" alt="Next Page"></i>
{%- else -%}❭
{%- endif -%}
</span>
{%- endif -%}
{%- if paginator.next -%}
<a class="on outp" href="{{ paginator.last | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Last Page">
{%- if icon_last -%}<i class="{{ icon_last }}" alt="Last Page"></i>
{%- else -%}❱
{%- endif -%}
</a>
{%- else -%}
<span class="off outp">
{%- if icon_last -%}<i class="{{ icon_last }}" alt="Last Page"></i>
{%- else -%}❱
{%- endif -%}
</span>
{%- endif -%}
</nav>
{%- endif %}
{%- endmacro %}
|