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
|
{# This Template Shows the Individual Blog Posts#}
{% extends "base.html" %}
{%- block seo %}
{{- super() }}
{%- set title_addition = "" %}
{%- if page.title and config.title %}
{%- set title = page.title %}
{%- set title_addition = title_separator ~ config.title %}
{%- elif page.title %}
{%- set title = page.title %}
{%- else %}
{%- set title = config.title %}
{%- endif %}
{%- if page.description %}
{%- set description = page.description %}
{%- else %}
{%- set description = config.description %}
{%- endif %}
{%- set created_time = page.date %}
{%- set updated_time = page.updated %}
{%- if current_section %}
{%- set page_section = current_section %}
{%- else %}
{%- set page_section = "" %}
{%- endif %}
{{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, type="article", is_page=true, created_time=created_time, updated_time=updated_time, page_section=page_section) }}
{%- endblock seo %}
{%- block comments_init %}
{%- if config.extra.comments.hyvor %}
<script defer src="https://talk.hyvor.com/embed/embed.js" type="module"></script>
{%- endif %}
{%- endblock comments_init %}
{%- block content %}
<article>
{{- macros::title_post(page=page, config=config) }}
{%- if config.extra.meta_post.position %}
{%- if config.extra.meta_post.position == "top" or config.extra.meta_post.position == "both" %}
{{- macros::meta_post(page=page, config=config) }}
{%- endif %}{%- endif %}
{# In Page Series Navigation #}
{%- if config.extra.series | default(value=true) %}
{%- if page.extra.series %}
{%- set tag = get_taxonomy_term(kind="tags", term=page.extra.series, lang=lang) %}
{%- set page_num = tag.page_count | as_str %}
{%- if lang != config.default_language %}
{%- set parts_string = macros::translate(key='Series_parts', default='Series', i18n=i18n) | replace(from="$NUMBER_OF_PARTS", to=page_num) %}
{% else %}
{%- set parts_string = config.extra.Series_parts | default(value="Series") | replace(from="$NUMBER_OF_PARTS", to=page_num) %}
{% endif -%}
<div class="block">
<div class="blockdiv">
<a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag.name }} ({{ parts_string }})</a>
<ol>
{%- for inner in tag.pages | sort(attribute="date") %}
{%- if inner.content == page.content %}
<li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}"><b>{{ inner.title }}</b></a></li>
{%- set_global current_section_index = loop.index0 %} {# Finds the current section, needed for pagination logic later #}
{% else %}
<li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li>
{%- endif %}
{%- endfor %}
</ol>
</div>
</div>
{%- endif %}
{%- endif %}
{{ page.content | safe }}
{%- if config.extra.meta_post.position %}
{%- if config.extra.meta_post.position == "bottom" or config.extra.meta_post.position == "both" %}
{{- macros::meta_post(page=page, config=config) }}
{%- endif %}{%- endif %}
{%- block page_footer %}
{{- macros::footer(page=page, config=config) }}
{%- endblock page_footer %}
{%- block comments_body %}
{%- if config.extra.comments.hyvor %}
<hyvor-talk-comments website-id={{ config.extra.comments.hyvor }} page-id={{ page.slug }}{%- if config.extra.comments.hyvorcolor %} colors="{{ config.extra.comments.hyvorcolor }}"{%- endif %}></hyvor-talk-comments>
{%- endif %}
{%- endblock comments_body %}
</article>
{%- block toc %}
{%- if config.extra.toc | default(value=true) %}
{%- if page.extra.toc %}
{%- set toc = page.toc %}
{%- endif %}
{%- if toc %}
<div class="sblock">
{%- if page.extra.series %}
{%- set num_extra_pages = config.extra.series_items | default(value=9) %}
<div class="blockdiv">
<a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ parts_string }}</a>
<ol>
{%- if tag.page_count > num_extra_pages and num_extra_pages > 0 %}
{%- set sorted_array = tag.pages | sort(attribute="date") %}
{%- set num_pages = tag.page_count %}
{# Shows the first page #}
{{ macros::series_link(inner=sorted_array.0, page=page) }}
{# Hides the next couple of pages if the current section is more than 3 away from start #}
{%- if current_section_index > 3 %}
<details>
<summary>More...</summary>
</details>
<div class="hidden_li">
{%- for inner in sorted_array | slice(start=1, end=(current_section_index - 2)) %}
<li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li>
{%- endfor %}
</div>
{%- endif %}
{# Max(current_section_index - 2, 1) #}
{%- if (current_section_index - 2 ) > 1 %}
{%- set num = current_section_index - 2 %}
{%- else %}
{%- set num = 1 %}
{%- endif %}
{# Shows two pages before current page #}
{%- for inner in sorted_array | slice(start=num, end=current_section_index) %}
<li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li>
{%- endfor %}
{# Shows the current page #}
{%- if current_section_index != 0 and current_section_index != (num_pages - 1) %}
{{ macros::series_link(inner=sorted_array[current_section_index], page=page) }}
{%- endif %}
{# Min(num_pages - 1, current_section_index + 3) #}
{%- if (num_pages - 2 ) < (current_section_index + 3) %}
{%- set num = num_pages - 1 %}
{%- else %}
{%- set num = current_section_index + 3 %}
{%- endif %}
{%- for inner in sorted_array | slice(start=(current_section_index + 1), end=num ) %}
<li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li>
{%- endfor %}
{%- if current_section_index < num_pages - 4 %}
<details>
<summary>More...</summary>
</details>
<div class="hidden_li">
{%- for inner in sorted_array | slice(start=(current_section_index + 3), end=(num_pages - 1)) %}
<li><a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a></li>
{%- endfor %}
</div>
{%- endif %}
{%- set last = num_pages - 1%}
{{ macros::series_link(inner=sorted_array[last], page=page) }}
{# If there is not more than max pages render normally #}
{%- else %}
{%- for inner in tag.pages | sort(attribute="date") %}
{{ macros::series_link(inner=inner, page=page) }}
{%- endfor %}
{%- endif %}
</ol>
</div>
{%- endif %}
<div class="blockdiv sticky">
<a class="b s150" href="#">{{ macros::translate(key="Index", default="Index", i18n=i18n) }}</a>
{%- for h in toc %}
<div>
<a href="#{{h.id | safe}}">{{ h.title }}</a>
</div>
{%- if h.children %}
{%- for h2 in h.children %}
<div class="hpad">
<a href="#{{h2.id | safe}}"><small>- {{ h2.title }}</small></a>
</div>
{%- endfor %}
{%- endif %}
{%- endfor %}
</div>
</div>
{%- endif %}
{%- endif %}
{%- endblock toc %}
{%- endblock content %}
{%- block gotop %}
{%- if page.reading_time %}
{%- if page.reading_time > 2 %}
{%- set icon_top=config.extra.icon_top | default(value="svgs svgh angu") -%}
<span class="topout">
<span class="topleft"> </span><a href="#" class="top" title="Back to Top">{%- if icon_top %}<i class="{{ icon_top }}"></i>{%- else %}⋏{%- endif %}</a>
</span>
{%- endif %}
{%- endif %}
{%- endblock gotop %}
|