jekyll-theme-coo 6.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +29 -0
- data/README.md +24 -0
- data/_data/locales/ar.yml +91 -0
- data/_data/locales/bg-BG.yml +81 -0
- data/_data/locales/cs-CZ.yml +89 -0
- data/_data/locales/de-DE.yml +87 -0
- data/_data/locales/el-GR.yml +91 -0
- data/_data/locales/en.yml +91 -0
- data/_data/locales/es-ES.yml +77 -0
- data/_data/locales/fi-FI.yml +90 -0
- data/_data/locales/fr-FR.yml +77 -0
- data/_data/locales/hu-HU.yml +79 -0
- data/_data/locales/id-ID.yml +77 -0
- data/_data/locales/it-IT.yml +90 -0
- data/_data/locales/ko-KR.yml +84 -0
- data/_data/locales/my-MM.yml +77 -0
- data/_data/locales/pt-BR.yml +77 -0
- data/_data/locales/ru-RU.yml +87 -0
- data/_data/locales/sl-SI.yml +91 -0
- data/_data/locales/sv-SE.yml +91 -0
- data/_data/locales/th.yml +91 -0
- data/_data/locales/tr-TR.yml +77 -0
- data/_data/locales/uk-UA.yml +77 -0
- data/_data/locales/vi-VN.yml +76 -0
- data/_data/locales/zh-CN.yml +83 -0
- data/_data/locales/zh-TW.yml +83 -0
- data/_data/origin/basic.yml +46 -0
- data/_data/origin/cors.yml +57 -0
- data/_includes/comments/disqus.html +50 -0
- data/_includes/comments/giscus.html +65 -0
- data/_includes/comments/utterances.html +50 -0
- data/_includes/comments.html +5 -0
- data/_includes/datetime.html +20 -0
- data/_includes/embed/twitch.html +8 -0
- data/_includes/embed/youtube.html +9 -0
- data/_includes/favicons.html +17 -0
- data/_includes/footer.html +36 -0
- data/_includes/google-analytics.html +14 -0
- data/_includes/head.html +99 -0
- data/_includes/js-selector.html +106 -0
- data/_includes/jsdelivr-combine.html +26 -0
- data/_includes/lang.html +8 -0
- data/_includes/language-alias.html +70 -0
- data/_includes/mermaid.html +58 -0
- data/_includes/metadata-hook.html +1 -0
- data/_includes/mode-toggle.html +143 -0
- data/_includes/no-linenos.html +10 -0
- data/_includes/notification.html +24 -0
- data/_includes/origin-type.html +13 -0
- data/_includes/post-nav.html +34 -0
- data/_includes/post-paginator.html +91 -0
- data/_includes/post-sharing.html +52 -0
- data/_includes/read-time.html +37 -0
- data/_includes/refactor-content.html +266 -0
- data/_includes/related-posts.html +96 -0
- data/_includes/search-loader.html +47 -0
- data/_includes/search-results.html +10 -0
- data/_includes/sidebar.html +106 -0
- data/_includes/toc.html +13 -0
- data/_includes/topbar.html +82 -0
- data/_includes/trending-tags.html +46 -0
- data/_includes/update-list.html +39 -0
- data/_layouts/archives.html +35 -0
- data/_layouts/categories.html +138 -0
- data/_layouts/category.html +24 -0
- data/_layouts/compress.html +10 -0
- data/_layouts/default.html +87 -0
- data/_layouts/home.html +16 -0
- data/_layouts/page.html +22 -0
- data/_layouts/post.html +24 -0
- data/_layouts/tag.html +23 -0
- data/_layouts/tags.html +22 -0
- data/_sass/addon/commons.scss +1537 -0
- data/_sass/addon/module.scss +200 -0
- data/_sass/addon/syntax.scss +292 -0
- data/_sass/addon/variables.scss +33 -0
- data/_sass/colors/syntax-dark.scss +164 -0
- data/_sass/colors/syntax-light.scss +214 -0
- data/_sass/colors/typography-dark.scss +151 -0
- data/_sass/colors/typography-light.scss +112 -0
- data/_sass/layout/archives.scss +144 -0
- data/_sass/layout/categories.scss +83 -0
- data/_sass/layout/category-tag.scss +72 -0
- data/_sass/layout/home.scss +189 -0
- data/_sass/layout/post.scss +357 -0
- data/_sass/layout/tags.scss +19 -0
- data/_sass/main.scss +13 -0
- data/_sass/variables-hook.scss +3 -0
- data/assets/404.html +14 -0
- data/assets/css/jekyll-theme-coo.scss +6 -0
- data/assets/feed.xml +61 -0
- data/assets/img/favicons/android-chrome-192x192.png +0 -0
- data/assets/img/favicons/android-chrome-512x512.png +0 -0
- data/assets/img/favicons/apple-touch-icon.png +0 -0
- data/assets/img/favicons/browserconfig.xml +13 -0
- data/assets/img/favicons/favicon-16x16.png +0 -0
- data/assets/img/favicons/favicon-32x32.png +0 -0
- data/assets/img/favicons/favicon.ico +0 -0
- data/assets/img/favicons/mstile-150x150.png +0 -0
- data/assets/img/favicons/site.webmanifest +26 -0
- data/assets/js/data/search.json +20 -0
- data/assets/js/data/swcache.js +49 -0
- data/assets/js/dist/categories.min.js +4 -0
- data/assets/js/dist/commons.min.js +4 -0
- data/assets/js/dist/home.min.js +4 -0
- data/assets/js/dist/misc.min.js +4 -0
- data/assets/js/dist/page.min.js +4 -0
- data/assets/js/dist/post.min.js +4 -0
- data/assets/js/pwa/app.js +47 -0
- data/assets/js/pwa/sw.js +89 -0
- data/assets/js/pwa/unregister.js +12 -0
- data/assets/robots.txt +10 -0
- metadata +261 -0
@@ -0,0 +1,266 @@
|
|
1
|
+
<!-- Refactor the HTML structure -->
|
2
|
+
|
3
|
+
{% assign _content = include.content %}
|
4
|
+
|
5
|
+
<!--
|
6
|
+
In order to allow a wide table to scroll horizontally,
|
7
|
+
we suround the markdown table with `<div class="table-wrapper">` and `</div>`
|
8
|
+
-->
|
9
|
+
|
10
|
+
{% if _content contains '<table' %}
|
11
|
+
{% assign _content = _content
|
12
|
+
| replace: '<table', '<div class="table-wrapper"><table'
|
13
|
+
| replace: '</table>', '</table></div>'
|
14
|
+
| replace: '<code><div class="table-wrapper">', '<code>'
|
15
|
+
| replace: '</table></div></code>', '</table></code>'
|
16
|
+
%}
|
17
|
+
{% endif %}
|
18
|
+
|
19
|
+
<!--
|
20
|
+
Fixed kramdown code highlight rendering:
|
21
|
+
https://github.com/penibelst/jekyll-compress-html/issues/101
|
22
|
+
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
23
|
+
-->
|
24
|
+
|
25
|
+
{% if _content contains '<pre class="highlight">' %}
|
26
|
+
{% assign _content = _content
|
27
|
+
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
|
28
|
+
| replace: '</code></pre></div>', '</code></div>'
|
29
|
+
%}
|
30
|
+
{% endif %}
|
31
|
+
|
32
|
+
<!-- Change the icon of checkbox -->
|
33
|
+
|
34
|
+
{% if _content contains '<input type="checkbox"' %}
|
35
|
+
{% assign _content = _content
|
36
|
+
| replace: '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
|
37
|
+
'<i class="fas fa-check-circle fa-fw checked"></i>'
|
38
|
+
| replace: '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
|
39
|
+
'<i class="far fa-circle fa-fw"></i>'
|
40
|
+
%}
|
41
|
+
{% endif %}
|
42
|
+
|
43
|
+
<!-- Handle images -->
|
44
|
+
|
45
|
+
{% assign IMG_TAG = '<img ' %}
|
46
|
+
|
47
|
+
{% if _content contains IMG_TAG %}
|
48
|
+
{% assign _img_content = null %}
|
49
|
+
{% assign _img_snippets = _content | split: IMG_TAG %}
|
50
|
+
|
51
|
+
<!-- CDN URL -->
|
52
|
+
{% if site.img_cdn %}
|
53
|
+
{% if site.img_cdn contains '//' %}
|
54
|
+
{% assign _path_prefix = site.img_cdn %}
|
55
|
+
{% else %}
|
56
|
+
{% assign _path_prefix = site.img_cdn | relative_url %}
|
57
|
+
{% endif %}
|
58
|
+
{% else %}
|
59
|
+
{% assign _path_prefix = site.baseurl %}
|
60
|
+
{% endif %}
|
61
|
+
|
62
|
+
<!-- Add image path -->
|
63
|
+
{% if page.img_path %}
|
64
|
+
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
|
65
|
+
{% assign _path_prefix = _path_prefix | append: _path %}
|
66
|
+
{% endif %}
|
67
|
+
|
68
|
+
{% for _img_snippet in _img_snippets %}
|
69
|
+
{% if forloop.first %}
|
70
|
+
{% assign _img_content = _img_snippet %}
|
71
|
+
{% continue %}
|
72
|
+
{% endif %}
|
73
|
+
|
74
|
+
{% assign _left = _img_snippet | split: '>' | first %}
|
75
|
+
{% assign _right = _img_snippet | remove: _left %}
|
76
|
+
|
77
|
+
{% unless _left contains 'src=' %}
|
78
|
+
{% continue %}
|
79
|
+
{% endunless %}
|
80
|
+
|
81
|
+
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
82
|
+
{% assign _attrs = _left | split: '" ' %}
|
83
|
+
|
84
|
+
{% assign _src = null %}
|
85
|
+
{% assign _lqip = null %}
|
86
|
+
{% assign _class = null %}
|
87
|
+
|
88
|
+
{% for _attr in _attrs %}
|
89
|
+
{% unless _attr contains '=' %}
|
90
|
+
{% continue %}
|
91
|
+
{% endunless %}
|
92
|
+
|
93
|
+
{% assign _pair = _attr | split: '="' %}
|
94
|
+
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
95
|
+
{% capture _value %}{{ _pair | last | remove: '"' }}{% endcapture %}
|
96
|
+
|
97
|
+
{% case _key %}
|
98
|
+
{% when 'src' %}
|
99
|
+
{% assign _src = _value %}
|
100
|
+
{% when 'lqip' %}
|
101
|
+
{% assign _lqip = _value %}
|
102
|
+
{% when 'class' %}
|
103
|
+
{% assign _class = _value %}
|
104
|
+
{% endcase %}
|
105
|
+
{% endfor %}
|
106
|
+
|
107
|
+
<!-- take out classes -->
|
108
|
+
{% if _class %}
|
109
|
+
{% capture _old_class %}class="{{ _class }}"{% endcapture %}
|
110
|
+
{% assign _left = _left | remove: _old_class %}
|
111
|
+
{% endif %}
|
112
|
+
|
113
|
+
{% assign _final_src = null %}
|
114
|
+
{% assign _lazyload = true %}
|
115
|
+
|
116
|
+
{% unless _src contains '//' %}
|
117
|
+
{% assign _final_src = _path_prefix | append: _src %}
|
118
|
+
{% assign _src_alt = 'src="' | append: _path_prefix %}
|
119
|
+
{% assign _left = _left | replace: 'src="', _src_alt %}
|
120
|
+
{% endunless %}
|
121
|
+
|
122
|
+
{% if _lqip %}
|
123
|
+
{% assign _lazyload = false %}
|
124
|
+
{% assign _class = _class | append: ' blur' %}
|
125
|
+
|
126
|
+
{% unless _lqip contains 'data:' %}
|
127
|
+
{% assign _lqip_alt = 'lqip="' | append: _path_prefix %}
|
128
|
+
{% assign _left = _left | replace: 'lqip="', _lqip_alt %}
|
129
|
+
{% endunless %}
|
130
|
+
|
131
|
+
<!-- add image placeholder -->
|
132
|
+
{% assign _left = _left | replace: 'src=', 'data-src=' | replace: ' lqip=', ' data-lqip="true" src=' %}
|
133
|
+
|
134
|
+
{% else %}
|
135
|
+
{% assign _class = _class | append: ' shimmer' %}
|
136
|
+
{% endif %}
|
137
|
+
|
138
|
+
<!-- lazy-load images -->
|
139
|
+
{% if _lazyload %}
|
140
|
+
{% assign _left = _left | append: ' loading="lazy"' %}
|
141
|
+
{% endif %}
|
142
|
+
|
143
|
+
{% if page.layout == 'home' %}
|
144
|
+
<!-- create the image wrapper -->
|
145
|
+
{% assign _wrapper_start = '<div class="preview-img ' | append: _class | append: '">' %}
|
146
|
+
|
147
|
+
{% assign _img_content = _img_content | append: _wrapper_start %}
|
148
|
+
{% assign _right = _right | prepend: '></div' %}
|
149
|
+
|
150
|
+
{% else %}
|
151
|
+
<!-- make sure the `<img>` is wrapped by `<a>` -->
|
152
|
+
{% assign _parent = _right | slice: 1, 4 %}
|
153
|
+
|
154
|
+
{% if _parent == '</a>' %}
|
155
|
+
<!-- add class to exist <a> tag -->
|
156
|
+
{% assign _size = _img_content | size | minus: 1 %}
|
157
|
+
{% capture _class %}
|
158
|
+
class="img-link{% unless _lqip %} shimmer{% endunless %}"
|
159
|
+
{% endcapture %}
|
160
|
+
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
|
161
|
+
|
162
|
+
{% else %}
|
163
|
+
<!-- create the image wrapper -->
|
164
|
+
{% assign _wrapper_start = _final_src
|
165
|
+
| default: _src
|
166
|
+
| prepend: '<a href="'
|
167
|
+
| append: '" class="popup img-link '
|
168
|
+
| append: _class
|
169
|
+
| append: '">'
|
170
|
+
%}
|
171
|
+
|
172
|
+
{% assign _img_content = _img_content | append: _wrapper_start %}
|
173
|
+
{% assign _right = '></a' | append: _right %}
|
174
|
+
{% endif %}
|
175
|
+
{% endif %}
|
176
|
+
|
177
|
+
<!-- combine -->
|
178
|
+
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
|
179
|
+
{% endfor %}
|
180
|
+
|
181
|
+
{% if _img_content %}
|
182
|
+
{% assign _content = _img_content %}
|
183
|
+
{% endif %}
|
184
|
+
{% endif %}
|
185
|
+
|
186
|
+
<!-- Add header for code snippets -->
|
187
|
+
|
188
|
+
{% if _content contains '<div class="highlight"><code>' %}
|
189
|
+
{% assign _code_spippets = _content | split: '<div class="highlight"><code>' %}
|
190
|
+
{% assign _new_content = '' %}
|
191
|
+
|
192
|
+
{% for _snippet in _code_spippets %}
|
193
|
+
{% if forloop.last %}
|
194
|
+
{% assign _new_content = _new_content | append: _snippet %}
|
195
|
+
|
196
|
+
{% else %}
|
197
|
+
{% assign _left = _snippet | split: '><' | last %}
|
198
|
+
|
199
|
+
{% if _left contains 'file="' %}
|
200
|
+
{% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
|
201
|
+
{% assign _label_icon = 'far fa-file-code fa-fw' %}
|
202
|
+
{% else %}
|
203
|
+
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
|
204
|
+
{% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
|
205
|
+
{% assign _label_icon = 'fas fa-code fa-fw small' %}
|
206
|
+
{% endif %}
|
207
|
+
|
208
|
+
{% capture _label %}
|
209
|
+
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
|
210
|
+
{% endcapture %}
|
211
|
+
|
212
|
+
{% assign _new_content = _new_content
|
213
|
+
| append: _snippet
|
214
|
+
| append: '<div class="code-header">'
|
215
|
+
| append: _label
|
216
|
+
| append: '<button aria-label="copy" data-title-succeed="'
|
217
|
+
| append: site.data.locales[include.lang].post.button.copy_code.succeed
|
218
|
+
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
219
|
+
| append: '<div class="highlight"><code>'
|
220
|
+
%}
|
221
|
+
{% endif %}
|
222
|
+
{% endfor %}
|
223
|
+
|
224
|
+
{% assign _content = _new_content %}
|
225
|
+
{% endif %}
|
226
|
+
|
227
|
+
<!-- Create heading anchors -->
|
228
|
+
|
229
|
+
{% assign heading_levels = '2,3,4,5' | split: ',' %}
|
230
|
+
{% assign _heading_content = _content %}
|
231
|
+
|
232
|
+
{% for level in heading_levels %}
|
233
|
+
{% assign mark_start = '<h' | append: level | append: ' id="' %}
|
234
|
+
{% assign mark_end = '</h' | append: level | append: '>' %}
|
235
|
+
|
236
|
+
{% if _heading_content contains mark_start %}
|
237
|
+
{% assign _new_content = null %}
|
238
|
+
{% assign heading_snippets = _heading_content | split: mark_start %}
|
239
|
+
|
240
|
+
{% for snippet in heading_snippets %}
|
241
|
+
{% if forloop.first %}
|
242
|
+
{% assign _new_content = snippet %}
|
243
|
+
{% continue %}
|
244
|
+
{% endif %}
|
245
|
+
|
246
|
+
{% assign id = snippet | split: '"' | first %}
|
247
|
+
{% assign anchor = '<a href="#'
|
248
|
+
| append: id
|
249
|
+
| append: '" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>'
|
250
|
+
%}
|
251
|
+
|
252
|
+
{% assign left = snippet | split: mark_end | first %}
|
253
|
+
{% assign right = snippet | slice: left.size, snippet.size %}
|
254
|
+
{% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
|
255
|
+
|
256
|
+
{% assign _new_content = _new_content | append: mark_start | append: left | append: anchor | append: right %}
|
257
|
+
{% endfor %}
|
258
|
+
|
259
|
+
{% assign _heading_content = _new_content %}
|
260
|
+
{% endif %}
|
261
|
+
{% endfor %}
|
262
|
+
|
263
|
+
{% assign _content = _heading_content %}
|
264
|
+
|
265
|
+
<!-- return -->
|
266
|
+
{{ _content }}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<!-- Recommend the other 3 posts according to the tags and categories of the current post. -->
|
2
|
+
|
3
|
+
<!-- The total size of related posts -->
|
4
|
+
{% assign TOTAL_SIZE = 3 %}
|
5
|
+
|
6
|
+
<!-- An random integer that bigger than 0 -->
|
7
|
+
{% assign TAG_SCORE = 1 %}
|
8
|
+
|
9
|
+
<!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
|
10
|
+
{% assign CATEGORY_SCORE = 0.5 %}
|
11
|
+
|
12
|
+
{% assign SEPARATOR = ':' %}
|
13
|
+
|
14
|
+
{% assign match_posts = '' | split: '' %}
|
15
|
+
|
16
|
+
{% for category in page.categories %}
|
17
|
+
{% assign match_posts = match_posts | push: site.categories[category] | uniq %}
|
18
|
+
{% endfor %}
|
19
|
+
|
20
|
+
{% for tag in page.tags %}
|
21
|
+
{% assign match_posts = match_posts | push: site.tags[tag] | uniq %}
|
22
|
+
{% endfor %}
|
23
|
+
|
24
|
+
{% assign last_index = match_posts.size | minus: 1 %}
|
25
|
+
{% assign score_list = '' | split: '' %}
|
26
|
+
|
27
|
+
{% for i in (0..last_index) %}
|
28
|
+
{% assign post = match_posts[i] %}
|
29
|
+
|
30
|
+
{% if post.url == page.url %}
|
31
|
+
{% continue %}
|
32
|
+
{% endif %}
|
33
|
+
|
34
|
+
{% assign score = 0 %}
|
35
|
+
|
36
|
+
{% for tag in post.tags %}
|
37
|
+
{% if page.tags contains tag %}
|
38
|
+
{% assign score = score | plus: TAG_SCORE %}
|
39
|
+
{% endif %}
|
40
|
+
{% endfor %}
|
41
|
+
|
42
|
+
{% for category in post.categories %}
|
43
|
+
{% if page.categories contains category %}
|
44
|
+
{% assign score = score | plus: CATEGORY_SCORE %}
|
45
|
+
{% endif %}
|
46
|
+
{% endfor %}
|
47
|
+
|
48
|
+
{% if score > 0 %}
|
49
|
+
{% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %}
|
50
|
+
{% assign score_list = score_list | push: score_item %}
|
51
|
+
{% endif %}
|
52
|
+
{% endfor %}
|
53
|
+
|
54
|
+
{% assign index_list = '' | split: '' %}
|
55
|
+
|
56
|
+
{% if score_list.size > 0 %}
|
57
|
+
{% assign score_list = score_list | sort | reverse %}
|
58
|
+
{% for entry in score_list limit: TOTAL_SIZE %}
|
59
|
+
{% assign index = entry | split: SEPARATOR | last %}
|
60
|
+
{% assign index_list = index_list | push: index %}
|
61
|
+
{% endfor %}
|
62
|
+
{% endif %}
|
63
|
+
|
64
|
+
{% assign relate_posts = '' | split: '' %}
|
65
|
+
|
66
|
+
{% for index in index_list %}
|
67
|
+
{% assign i = index | to_integer %}
|
68
|
+
{% assign relate_posts = relate_posts | push: match_posts[i] %}
|
69
|
+
{% endfor %}
|
70
|
+
|
71
|
+
{% if relate_posts.size > 0 %}
|
72
|
+
<aside id="related-posts" aria-labelledby="related-label">
|
73
|
+
<h3 class="mb-4" id="related-label">
|
74
|
+
{{- site.data.locales[include.lang].post.relate_posts -}}
|
75
|
+
</h3>
|
76
|
+
<nav class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4">
|
77
|
+
{% for post in relate_posts %}
|
78
|
+
<article class="col">
|
79
|
+
<a href="{{ post.url | relative_url }}" class="post-preview card h-100">
|
80
|
+
<div class="card-body">
|
81
|
+
{% include datetime.html date=post.date lang=include.lang %}
|
82
|
+
<h4 class="pt-0 my-2">{{ post.title }}</h4>
|
83
|
+
<div class="text-muted">
|
84
|
+
<p>
|
85
|
+
{% include no-linenos.html content=post.content %}
|
86
|
+
{{ content | markdownify | strip_html | truncate: 200 | escape }}
|
87
|
+
</p>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
</a>
|
91
|
+
</article>
|
92
|
+
{% endfor %}
|
93
|
+
</nav>
|
94
|
+
</aside>
|
95
|
+
<!-- #related-posts -->
|
96
|
+
{% endif %}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<!--
|
2
|
+
Jekyll Simple Search loader
|
3
|
+
See: <https://github.com/christian-fei/Simple-Jekyll-Search>
|
4
|
+
-->
|
5
|
+
|
6
|
+
{% capture result_elem %}
|
7
|
+
<article class="px-1 px-sm-2 px-lg-4 px-xl-0">
|
8
|
+
<header>
|
9
|
+
<h2><a href="{url}">{title}</a></h2>
|
10
|
+
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
|
11
|
+
{categories}
|
12
|
+
{tags}
|
13
|
+
</div>
|
14
|
+
</header>
|
15
|
+
<p>{snippet}</p>
|
16
|
+
</article>
|
17
|
+
{% endcapture %}
|
18
|
+
|
19
|
+
{% capture not_found %}<p class="mt-5">{{ site.data.locales[include.lang].search.no_results }}</p>{% endcapture %}
|
20
|
+
|
21
|
+
<script>
|
22
|
+
/* Note: dependent library will be loaded in `js-selector.html` */
|
23
|
+
SimpleJekyllSearch({
|
24
|
+
searchInput: document.getElementById('search-input'),
|
25
|
+
resultsContainer: document.getElementById('search-results'),
|
26
|
+
json: '{{ '/assets/js/data/search.json' | relative_url }}',
|
27
|
+
searchResultTemplate: '{{ result_elem | strip_newlines }}',
|
28
|
+
noResultsText: '{{ not_found }}',
|
29
|
+
templateMiddleware: function(prop, value, template) {
|
30
|
+
if (prop === 'categories') {
|
31
|
+
if (value === '') {
|
32
|
+
return `${value}`;
|
33
|
+
} else {
|
34
|
+
return `<div class="me-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
if (prop === 'tags') {
|
39
|
+
if (value === '') {
|
40
|
+
return `${value}`;
|
41
|
+
} else {
|
42
|
+
return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
});
|
47
|
+
</script>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!-- The Search results -->
|
2
|
+
|
3
|
+
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
|
4
|
+
<div class="col-11 content">
|
5
|
+
<div id="search-hints">
|
6
|
+
{% include_cached trending-tags.html %}
|
7
|
+
</div>
|
8
|
+
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
<!-- The Side Bar -->
|
2
|
+
|
3
|
+
<aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
|
4
|
+
<header class="profile-wrapper">
|
5
|
+
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
|
6
|
+
{% if site.avatar != empty and site.avatar %}
|
7
|
+
{% capture avatar_url %}
|
8
|
+
{% if site.avatar contains '://' %}
|
9
|
+
{{ site.avatar }}
|
10
|
+
{% elsif site.img_cdn != empty and site.img_cdn %}
|
11
|
+
{{ site.avatar | prepend: site.img_cdn }}
|
12
|
+
{% else %}
|
13
|
+
{{ site.avatar | relative_url }}
|
14
|
+
{% endif %}
|
15
|
+
{% endcapture %}
|
16
|
+
<img src="{{ avatar_url | strip }}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
|
17
|
+
{% endif %}
|
18
|
+
</a>
|
19
|
+
|
20
|
+
<h1 class="site-title">
|
21
|
+
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
|
22
|
+
</h1>
|
23
|
+
<p class="site-subtitle fst-italic mb-0">{{ site.tagline }}</p>
|
24
|
+
</header>
|
25
|
+
<!-- .profile-wrapper -->
|
26
|
+
|
27
|
+
<!-- Table of contents -->
|
28
|
+
<nav class="flex-column flex-grow-1 w-100 ps-0">
|
29
|
+
<ul class="nav">
|
30
|
+
{% for item in site.data.summary.toc %}
|
31
|
+
<li class="nav-item{% if item.url == page.url %}{{ " active" }}{% endif %}">
|
32
|
+
<a href="{{ item.url }}" class="nav-link">
|
33
|
+
<span>{{ item.title }}</span>
|
34
|
+
</a>
|
35
|
+
|
36
|
+
{% if item.subfolder %}
|
37
|
+
<ul class="nav">
|
38
|
+
{% for sec in item.subfolder %}
|
39
|
+
<li class="nav-item{% if sec.url == page.url %}{{ " active" }}{% endif %}">
|
40
|
+
<a href="{{ sec.url }}" class="nav-link">
|
41
|
+
<span>{{ sec.title }}</span>
|
42
|
+
</a>
|
43
|
+
</li>
|
44
|
+
{% endfor %}
|
45
|
+
</ul>
|
46
|
+
{% endif %}
|
47
|
+
</li>
|
48
|
+
{% endfor %}
|
49
|
+
</ul>
|
50
|
+
</nav>
|
51
|
+
|
52
|
+
<div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
|
53
|
+
{% unless site.theme_mode %}
|
54
|
+
<button type="button" class="mode-toggle btn" aria-label="Switch Mode">
|
55
|
+
<i class="fas fa-adjust"></i>
|
56
|
+
</button>
|
57
|
+
|
58
|
+
{% if site.data.contact.size > 0 %}
|
59
|
+
<span class="icon-border"></span>
|
60
|
+
{% endif %}
|
61
|
+
{% endunless %}
|
62
|
+
|
63
|
+
{% for entry in site.data.contact %}
|
64
|
+
{% case entry.type %}
|
65
|
+
{% when 'github', 'twitter' %}
|
66
|
+
{%- capture url -%}
|
67
|
+
https://{{ entry.type }}.com/{{ site[entry.type].username }}
|
68
|
+
{%- endcapture -%}
|
69
|
+
{% when 'email' %}
|
70
|
+
{% assign email = site.social.email | split: '@' %}
|
71
|
+
{%- capture url -%}
|
72
|
+
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
73
|
+
{%- endcapture -%}
|
74
|
+
{% when 'rss' %}
|
75
|
+
{% assign url = '/feed.xml' | relative_url %}
|
76
|
+
{% else %}
|
77
|
+
{% assign url = entry.url %}
|
78
|
+
{% endcase %}
|
79
|
+
|
80
|
+
{% if url %}
|
81
|
+
<a
|
82
|
+
href="{{ url }}"
|
83
|
+
aria-label="{{ entry.type }}"
|
84
|
+
{% assign link_types = '' %}
|
85
|
+
|
86
|
+
{% unless entry.noblank %}
|
87
|
+
target="_blank"
|
88
|
+
{% assign link_types = 'noopener noreferrer' %}
|
89
|
+
{% endunless %}
|
90
|
+
|
91
|
+
{% if entry.type == 'mastodon' %}
|
92
|
+
{% assign link_types = link_types | append: ' me' | strip %}
|
93
|
+
{% endif %}
|
94
|
+
|
95
|
+
{% unless link_types == empty %}
|
96
|
+
rel="{{ link_types }}"
|
97
|
+
{% endunless %}
|
98
|
+
>
|
99
|
+
<i class="{{ entry.icon }}"></i>
|
100
|
+
</a>
|
101
|
+
{% endif %}
|
102
|
+
{% endfor %}
|
103
|
+
</div>
|
104
|
+
<!-- .sidebar-bottom -->
|
105
|
+
</aside>
|
106
|
+
<!-- #sidebar -->
|
data/_includes/toc.html
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{% assign enable_toc = false %}
|
2
|
+
{% if site.toc and page.toc %}
|
3
|
+
{% if page.content contains '<h2' or page.content contains '<h3' %}
|
4
|
+
{% assign enable_toc = true %}
|
5
|
+
{% endif %}
|
6
|
+
{% endif %}
|
7
|
+
|
8
|
+
{% if enable_toc %}
|
9
|
+
<section id="toc-wrapper" class="ps-0 pe-4">
|
10
|
+
<h2 class="panel-heading ps-3 pt-2 mb-2">{{- site.data.locales[include.lang].panel.toc -}}</h2>
|
11
|
+
<nav id="toc"></nav>
|
12
|
+
</section>
|
13
|
+
{% endif %}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<!-- The Top Bar -->
|
2
|
+
|
3
|
+
<header id="topbar-wrapper" aria-label="Top Bar">
|
4
|
+
<div
|
5
|
+
id="topbar"
|
6
|
+
class="d-flex align-items-center justify-content-between px-lg-3 h-100"
|
7
|
+
>
|
8
|
+
<nav id="breadcrumb" aria-label="Breadcrumb">
|
9
|
+
<!-- {% assign paths = page.url | split: '/' %}
|
10
|
+
<span>
|
11
|
+
<a href="{{ '/' | relative_url }}">
|
12
|
+
{{ site.title }}
|
13
|
+
</a>
|
14
|
+
</span> -->
|
15
|
+
|
16
|
+
<!-- {% if paths.size == 0 or page.layout == 'home' %} -->
|
17
|
+
<!-- index page -->
|
18
|
+
<!-- <span>{{ site.data.locales[include.lang].tabs.home | capitalize }}</span>
|
19
|
+
|
20
|
+
{% else %}
|
21
|
+
{% for item in paths %}
|
22
|
+
{% if forloop.first %}
|
23
|
+
<span>
|
24
|
+
<a href="{{ '/' | relative_url }}">
|
25
|
+
{{ site.data.locales[include.lang].tabs.home | capitalize }}
|
26
|
+
</a>
|
27
|
+
</span>
|
28
|
+
|
29
|
+
{% elsif forloop.last %}
|
30
|
+
{% if page.collection == 'tabs' %}
|
31
|
+
<span>{{ site.data.locales[include.lang].tabs[item] | default: page.title }}</span>
|
32
|
+
{% else %}
|
33
|
+
<span>{{ page.title }}</span>
|
34
|
+
{% endif %}
|
35
|
+
|
36
|
+
{% elsif page.layout == 'category' or page.layout == 'tag' %}
|
37
|
+
<span>
|
38
|
+
<a href="{{ item | relative_url }}">
|
39
|
+
{{ site.data.locales[include.lang].tabs[item] | default: page.title }}
|
40
|
+
</a>
|
41
|
+
</span>
|
42
|
+
{% endif %}
|
43
|
+
{% endfor %}
|
44
|
+
{% endif %} -->
|
45
|
+
</nav>
|
46
|
+
<!-- endof #breadcrumb -->
|
47
|
+
|
48
|
+
<button type="button" id="sidebar-trigger" class="btn btn-link">
|
49
|
+
<i class="fas fa-bars fa-fw"></i>
|
50
|
+
</button>
|
51
|
+
|
52
|
+
<div id="topbar-title">
|
53
|
+
{% if page.layout == 'home' %}
|
54
|
+
{{- site.data.locales[include.lang].title | default: site.title -}}
|
55
|
+
{% elsif page.collection == 'tabs' or page.layout == 'page' %}
|
56
|
+
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
|
57
|
+
{{- site.data.locales[include.lang].tabs[tab_key] | default: page.title -}}
|
58
|
+
{% else %}
|
59
|
+
{{- site.data.locales[include.lang].layout[page.layout] | default: page.layout | capitalize -}}
|
60
|
+
{% endif %}
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<button type="button" id="search-trigger" class="btn btn-link">
|
64
|
+
<i class="fas fa-search fa-fw"></i>
|
65
|
+
</button>
|
66
|
+
|
67
|
+
<search class="align-items-center ms-3 ms-lg-0">
|
68
|
+
<i class="fas fa-search fa-fw"></i>
|
69
|
+
<input
|
70
|
+
class="form-control"
|
71
|
+
id="search-input"
|
72
|
+
type="search"
|
73
|
+
aria-label="search"
|
74
|
+
autocomplete="off"
|
75
|
+
placeholder="{{ site.data.locales[include.lang].search.hint | capitalize }}..."
|
76
|
+
>
|
77
|
+
</search>
|
78
|
+
<button type="button" class="btn btn-link text-decoration-none" id="search-cancel">
|
79
|
+
{{- site.data.locales[include.lang].search.cancel -}}
|
80
|
+
</button>
|
81
|
+
</div>
|
82
|
+
</header>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<!-- The trending tags list -->
|
2
|
+
|
3
|
+
{% assign MAX = 10 %}
|
4
|
+
|
5
|
+
{% assign size_list = '' | split: '' %}
|
6
|
+
{% assign tag_list = '' | split: '' %}
|
7
|
+
|
8
|
+
{% for tag in site.tags %}
|
9
|
+
{% assign size = tag | last | size %}
|
10
|
+
{% assign size_list = size_list | push: size %}
|
11
|
+
|
12
|
+
{% assign tag_str = tag | first | append: '::' | append: size %}
|
13
|
+
{% assign tag_list = tag_list | push: tag_str %}
|
14
|
+
{% endfor %}
|
15
|
+
|
16
|
+
{% assign size_list = size_list | sort | reverse %}
|
17
|
+
|
18
|
+
{% assign tag_list = tag_list | sort_natural %}
|
19
|
+
|
20
|
+
{% assign trending_tags = '' | split: '' %}
|
21
|
+
|
22
|
+
{% for size in size_list limit: MAX %}
|
23
|
+
{% for tag_str in tag_list %}
|
24
|
+
{% assign tag = tag_str | split: '::' %}
|
25
|
+
{% assign tag_name = tag | first %}
|
26
|
+
{% assign tag_size = tag | last | plus: 0 %}
|
27
|
+
{% if tag_size == size %}
|
28
|
+
{% unless trending_tags contains tag_name %}
|
29
|
+
{% assign trending_tags = trending_tags | push: tag_name %}
|
30
|
+
{% break %}
|
31
|
+
{% endunless %}
|
32
|
+
{% endif %}
|
33
|
+
{% endfor %}
|
34
|
+
{% endfor %}
|
35
|
+
|
36
|
+
{% if trending_tags.size > 0 %}
|
37
|
+
<section>
|
38
|
+
<h2 class="panel-heading">{{- site.data.locales[include.lang].panel.trending_tags -}}</h2>
|
39
|
+
<div class="d-flex flex-wrap mt-3 mb-1 me-3">
|
40
|
+
{% for tag_name in trending_tags %}
|
41
|
+
{% assign url = tag_name | slugify | url_encode | prepend: '/tags/' | append: '/' %}
|
42
|
+
<a class="post-tag btn btn-outline-primary" href="{{ url | relative_url }}">{{ tag_name }}</a>
|
43
|
+
{% endfor %}
|
44
|
+
</div>
|
45
|
+
</section>
|
46
|
+
{% endif %}
|