jekyll-theme-chirpy 5.6.1 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/_data/locales/ar.yml +5 -7
  3. data/_data/locales/bg-BG.yml +1 -3
  4. data/_data/locales/cs-CZ.yml +5 -7
  5. data/_data/locales/de-DE.yml +1 -3
  6. data/_data/locales/el-GR.yml +6 -8
  7. data/_data/locales/en.yml +5 -7
  8. data/_data/locales/es-ES.yml +2 -4
  9. data/_data/locales/fi-FI.yml +5 -7
  10. data/_data/locales/fr-FR.yml +0 -2
  11. data/_data/locales/hu-HU.yml +4 -6
  12. data/_data/locales/id-ID.yml +1 -3
  13. data/_data/locales/it-IT.yml +5 -8
  14. data/_data/locales/ko-KR.yml +3 -5
  15. data/_data/locales/my-MM.yml +1 -3
  16. data/_data/locales/pt-BR.yml +1 -3
  17. data/_data/locales/ru-RU.yml +1 -3
  18. data/_data/locales/sl-SI.yml +91 -0
  19. data/_data/locales/sv-SE.yml +91 -0
  20. data/_data/locales/tr-TR.yml +1 -3
  21. data/_data/locales/uk-UA.yml +1 -3
  22. data/_data/locales/vi-VN.yml +2 -3
  23. data/_data/locales/zh-CN.yml +3 -5
  24. data/_data/locales/zh-TW.yml +83 -0
  25. data/_data/{assets/cross_origin.yml → origin/cors.yml} +12 -12
  26. data/_includes/comments/giscus.html +39 -31
  27. data/_includes/datetime.html +10 -6
  28. data/_includes/footer.html +24 -26
  29. data/_includes/head.html +9 -9
  30. data/_includes/js-selector.html +44 -27
  31. data/_includes/jsdelivr-combine.html +0 -6
  32. data/_includes/lang.html +8 -0
  33. data/_includes/mermaid.html +28 -29
  34. data/_includes/metadata-hook.html +1 -0
  35. data/_includes/mode-toggle.html +44 -21
  36. data/_includes/{assets-origin.html → origin-type.html} +5 -4
  37. data/_includes/post-nav.html +27 -20
  38. data/_includes/post-paginator.html +13 -12
  39. data/_includes/post-sharing.html +21 -13
  40. data/_includes/read-time.html +17 -10
  41. data/_includes/refactor-content.html +31 -27
  42. data/_includes/related-posts.html +35 -34
  43. data/_includes/search-loader.html +23 -24
  44. data/_includes/search-results.html +3 -4
  45. data/_includes/sidebar.html +50 -52
  46. data/_includes/toc.html +2 -5
  47. data/_includes/topbar.html +47 -47
  48. data/_includes/trending-tags.html +13 -17
  49. data/_includes/update-list.html +13 -14
  50. data/_layouts/archives.html +5 -3
  51. data/_layouts/categories.html +97 -77
  52. data/_layouts/category.html +10 -8
  53. data/_layouts/default.html +34 -29
  54. data/_layouts/home.html +35 -18
  55. data/_layouts/page.html +38 -33
  56. data/_layouts/post.html +17 -15
  57. data/_layouts/tag.html +10 -8
  58. data/_layouts/tags.html +4 -5
  59. data/_sass/addon/commons.scss +260 -439
  60. data/_sass/addon/module.scss +18 -8
  61. data/_sass/addon/syntax.scss +42 -41
  62. data/_sass/addon/variables.scss +8 -11
  63. data/_sass/colors/dark-syntax.scss +1 -0
  64. data/_sass/colors/dark-typography.scss +16 -24
  65. data/_sass/colors/light-syntax.scss +3 -3
  66. data/_sass/colors/light-typography.scss +16 -15
  67. data/_sass/jekyll-theme-chirpy.scss +14 -19
  68. data/_sass/layout/categories.scss +20 -4
  69. data/_sass/layout/home.scss +111 -94
  70. data/_sass/layout/post.scss +35 -32
  71. data/assets/404.html +3 -1
  72. data/assets/css/style.scss +1 -7
  73. data/assets/feed.xml +1 -1
  74. data/assets/js/dist/categories.min.js +2 -2
  75. data/assets/js/dist/commons.min.js +2 -2
  76. data/assets/js/dist/home.min.js +6 -0
  77. data/assets/js/dist/misc.min.js +2 -2
  78. data/assets/js/dist/page.min.js +2 -2
  79. data/assets/js/dist/post.min.js +2 -2
  80. metadata +11 -5
  81. /data/_data/{assets/self_host.yml → origin/basic.yml} +0 -0
@@ -1,14 +1,22 @@
1
- <!--
2
- Switch the mode between dark and light.
3
- -->
1
+ <!-- Switch the mode between dark and light. -->
4
2
 
5
3
  <script type="text/javascript">
6
4
  class ModeToggle {
7
- static get MODE_KEY() { return "mode"; }
8
- static get MODE_ATTR() { return "data-mode"; }
9
- static get DARK_MODE() { return "dark"; }
10
- static get LIGHT_MODE() { return "light"; }
11
- static get ID() { return "mode-toggle"; }
5
+ static get MODE_KEY() {
6
+ return 'mode';
7
+ }
8
+ static get MODE_ATTR() {
9
+ return 'data-mode';
10
+ }
11
+ static get DARK_MODE() {
12
+ return 'dark';
13
+ }
14
+ static get LIGHT_MODE() {
15
+ return 'light';
16
+ }
17
+ static get ID() {
18
+ return 'mode-toggle';
19
+ }
12
20
 
13
21
  constructor() {
14
22
  if (this.hasMode) {
@@ -45,17 +53,29 @@
45
53
  });
46
54
  } /* constructor() */
47
55
 
48
- get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); }
56
+ get sysDarkPrefers() {
57
+ return window.matchMedia('(prefers-color-scheme: dark)');
58
+ }
49
59
 
50
- get isSysDarkPrefer() { return this.sysDarkPrefers.matches; }
60
+ get isSysDarkPrefer() {
61
+ return this.sysDarkPrefers.matches;
62
+ }
51
63
 
52
- get isDarkMode() { return this.mode === ModeToggle.DARK_MODE; }
64
+ get isDarkMode() {
65
+ return this.mode === ModeToggle.DARK_MODE;
66
+ }
53
67
 
54
- get isLightMode() { return this.mode === ModeToggle.LIGHT_MODE; }
68
+ get isLightMode() {
69
+ return this.mode === ModeToggle.LIGHT_MODE;
70
+ }
55
71
 
56
- get hasMode() { return this.mode != null; }
72
+ get hasMode() {
73
+ return this.mode != null;
74
+ }
57
75
 
58
- get mode() { return sessionStorage.getItem(ModeToggle.MODE_KEY); }
76
+ get mode() {
77
+ return sessionStorage.getItem(ModeToggle.MODE_KEY);
78
+ }
59
79
 
60
80
  /* get the current mode on screen */
61
81
  get modeStatus() {
@@ -67,26 +87,29 @@
67
87
  }
68
88
 
69
89
  setDark() {
70
- $('html').attr(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
90
+ document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
71
91
  sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
72
92
  }
73
93
 
74
94
  setLight() {
75
- $('html').attr(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
95
+ document.documentElement.setAttribute(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
76
96
  sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
77
97
  }
78
98
 
79
99
  clearMode() {
80
- $('html').removeAttr(ModeToggle.MODE_ATTR);
100
+ document.documentElement.removeAttribute(ModeToggle.MODE_ATTR);
81
101
  sessionStorage.removeItem(ModeToggle.MODE_KEY);
82
102
  }
83
103
 
84
104
  /* Notify another plugins that the theme mode has changed */
85
105
  notify() {
86
- window.postMessage({
87
- direction: ModeToggle.ID,
88
- message: this.modeStatus
89
- }, "*");
106
+ window.postMessage(
107
+ {
108
+ direction: ModeToggle.ID,
109
+ message: this.modeStatus
110
+ },
111
+ '*'
112
+ );
90
113
  }
91
114
 
92
115
  flipMode() {
@@ -1,12 +1,13 @@
1
- {% comment %} Site static assets origin {% endcomment %}
2
- {% assign origin = 'cross_origin' %}
1
+ {% comment %} Site static assets origin type {% endcomment %}
2
+
3
+ {% assign type = 'cors' %}
3
4
 
4
5
  {% if site.assets.self_host.enabled %}
5
6
  {% if site.assets.self_host.env %}
6
7
  {% if site.assets.self_host.env == jekyll.environment %}
7
- {% assign origin = 'self_host' %}
8
+ {% assign type = 'basic' %}
8
9
  {% endif %}
9
10
  {% else %}
10
- {% assign origin = 'self_host' %}
11
+ {% assign type = 'basic' %}
11
12
  {% endif %}
12
13
  {% endif %}
@@ -1,30 +1,37 @@
1
- <!--
2
- Navigation buttons at the bottom of the post.
3
- -->
1
+ <!-- Navigation buttons at the bottom of the post. -->
4
2
 
5
3
  <div class="post-navigation d-flex justify-content-between">
6
4
  {% if page.previous.url %}
7
- <a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
8
- prompt="{{ site.data.locales[site.lang].post.button.previous }}">
9
- <p>{{ page.previous.title }}</p>
10
- </a>
5
+ <a
6
+ href="{{ site.baseurl }}{{ page.previous.url }}"
7
+ class="btn btn-outline-primary"
8
+ prompt="{{ site.data.locales[include.lang].post.button.previous }}"
9
+ >
10
+ <p>{{ page.previous.title }}</p>
11
+ </a>
11
12
  {% else %}
12
- <div class="btn btn-outline-primary disabled"
13
- prompt="{{ site.data.locales[site.lang].post.button.previous }}">
14
- <p>-</p>
15
- </div>
13
+ <div
14
+ class="btn btn-outline-primary disabled"
15
+ prompt="{{ site.data.locales[include.lang].post.button.previous }}"
16
+ >
17
+ <p>-</p>
18
+ </div>
16
19
  {% endif %}
17
20
 
18
21
  {% if page.next.url %}
19
- <a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
20
- prompt="{{ site.data.locales[site.lang].post.button.next }}">
21
- <p>{{ page.next.title }}</p>
22
- </a>
22
+ <a
23
+ href="{{ site.baseurl }}{{page.next.url}}"
24
+ class="btn btn-outline-primary"
25
+ prompt="{{ site.data.locales[include.lang].post.button.next }}"
26
+ >
27
+ <p>{{ page.next.title }}</p>
28
+ </a>
23
29
  {% else %}
24
- <div class="btn btn-outline-primary disabled"
25
- prompt="{{ site.data.locales[site.lang].post.button.next }}">
26
- <p>-</p>
27
- </div>
30
+ <div
31
+ class="btn btn-outline-primary disabled"
32
+ prompt="{{ site.data.locales[include.lang].post.button.next }}"
33
+ >
34
+ <p>-</p>
35
+ </div>
28
36
  {% endif %}
29
-
30
37
  </div>
@@ -1,13 +1,11 @@
1
- <!--
2
- The paginator for post list on HomgPage.
3
- -->
1
+ <!-- The paginator for post list on HomgPage. -->
4
2
 
5
- <ul class="pagination align-items-center mt-4 pl-lg-2">
3
+ <ul class="pagination align-items-center mt-4 mb-1 ps-lg-2">
6
4
  <!-- left arrow -->
7
5
  {% if paginator.previous_page %}
8
6
  {% assign prev_url = paginator.previous_page_path | relative_url %}
9
7
  {% else %}
10
- {% assign prev_url = "#" %}
8
+ {% assign prev_url = '#' %}
11
9
  {% endif %}
12
10
 
13
11
  <li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
@@ -21,7 +19,6 @@
21
19
  {% assign right_ellipsis = false %}
22
20
 
23
21
  {% for i in (1..paginator.total_pages) %}
24
-
25
22
  {% assign pre = paginator.page | minus: 1 %}
26
23
  {% assign next = paginator.page | plus: 1 %}
27
24
  {% assign pre_less = pre | minus: 1 %}
@@ -37,7 +34,7 @@
37
34
  {% assign show = true %}
38
35
  {% endif %}
39
36
  {% else %}
40
- {% if i == 1 or i == paginator.total_pages%}
37
+ {% if i == 1 or i == paginator.total_pages %}
41
38
  {% assign show = true %}
42
39
  {% elsif i >= pre and i <= next %}
43
40
  {% assign show = true %}
@@ -47,7 +44,12 @@
47
44
  {% if show %}
48
45
  <!-- show number -->
49
46
  <li class="page-item {% if i == paginator.page %} active{% endif %}">
50
- <a class="page-link btn-box-shadow" href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}">{{ i }}</a>
47
+ <a
48
+ class="page-link btn-box-shadow"
49
+ href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}"
50
+ >
51
+ {{- i -}}
52
+ </a>
51
53
  </li>
52
54
  {% else %}
53
55
  <!-- hide number -->
@@ -63,7 +65,6 @@
63
65
  {% assign right_ellipsis = true %}
64
66
  {% endif %}
65
67
  {% endif %}
66
-
67
68
  {% endfor %}
68
69
 
69
70
  <!-- mobile pagination -->
@@ -76,7 +77,7 @@
76
77
  {% if paginator.next_page_path %}
77
78
  {% assign next_url = paginator.next_page_path | relative_url %}
78
79
  {% else %}
79
- {% assign next_url = "#" %}
80
+ {% assign next_url = '#' %}
80
81
  {% endif %}
81
82
 
82
83
  <li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
@@ -84,5 +85,5 @@
84
85
  <i class="fas fa-angle-right"></i>
85
86
  </a>
86
87
  </li>
87
-
88
- </ul> <!-- .pagination -->
88
+ </ul>
89
+ <!-- .pagination -->
@@ -1,9 +1,7 @@
1
- <!--
2
- Post sharing snippet
3
- -->
1
+ <!-- Post sharing snippet -->
4
2
 
5
3
  <div class="share-wrapper">
6
- <span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share }}</span>
4
+ <span class="share-label text-muted me-1">{{ site.data.locales[include.lang].post.share }}</span>
7
5
  <span class="share-icons">
8
6
  {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
9
7
  {% assign title = title | uri_escape %}
@@ -11,17 +9,27 @@
11
9
 
12
10
  {% for share in site.data.share.platforms %}
13
11
  {% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
14
- <a href="{{ link }}" data-toggle="tooltip" data-placement="top"
15
- title="{{ share.type }}" target="_blank" rel="noopener" aria-label="{{ share.type }}">
16
- <i class="fa-fw {{ share.icon }}"></i>
17
- </a>
12
+ <a
13
+ href="{{ link }}"
14
+ data-bs-toggle="tooltip"
15
+ data-bs-placement="top"
16
+ title="{{ share.type }}"
17
+ target="_blank"
18
+ rel="noopener"
19
+ aria-label="{{ share.type }}"
20
+ >
21
+ <i class="fa-fw {{ share.icon }}"></i>
22
+ </a>
18
23
  {% endfor %}
19
24
 
20
- <i id="copy-link" class="fa-fw fas fa-link small"
21
- data-toggle="tooltip" data-placement="top"
22
- title="{{ site.data.locales[site.lang].post.button.share_link.title }}"
23
- data-title-succeed="{{ site.data.locales[site.lang].post.button.share_link.succeed }}">
25
+ <i
26
+ id="copy-link"
27
+ class="fa-fw fas fa-link small"
28
+ data-bs-toggle="tooltip"
29
+ data-bs-placement="top"
30
+ title="{{ site.data.locales[include.lang].post.button.share_link.title }}"
31
+ data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}"
32
+ >
24
33
  </i>
25
-
26
34
  </span>
27
35
  </div>
@@ -1,10 +1,8 @@
1
- <!--
2
- Calculate the post's reading time, and display the word count in tooltip
3
- -->
1
+ <!-- Calculate the post's reading time, and display the word count in tooltip -->
4
2
 
5
- {% assign words = include.content | strip_html | number_of_words: "auto" %}
3
+ {% assign words = include.content | strip_html | number_of_words: 'auto' %}
6
4
 
7
- <!-- words per minute -->
5
+ <!-- words per minute -->
8
6
 
9
7
  {% assign wpm = 180 %}
10
8
  {% assign min_time = 1 %}
@@ -16,15 +14,24 @@
16
14
  {% endunless %}
17
15
 
18
16
  {% capture read_prompt %}
19
- {{- site.data.locales[site.lang].post.read_time.prompt -}}
17
+ {{- site.data.locales[include.lang].post.read_time.prompt -}}
20
18
  {% endcapture %}
21
19
 
22
20
  <!-- return element -->
23
- <span class="readtime" data-toggle="tooltip" data-placement="bottom"
24
- title="{{ words }} {{ site.data.locales[site.lang].post.words }}">
25
- <em>{{- read_time -}}{{" "}}{{- site.data.locales[site.lang].post.read_time.unit -}}</em>
21
+ <span
22
+ class="readtime"
23
+ data-bs-toggle="tooltip"
24
+ data-bs-placement="bottom"
25
+ title="{{ words }} {{ site.data.locales[include.lang].post.words }}"
26
+ >
27
+ <em>
28
+ {{- read_time -}}
29
+ {{ ' ' }}
30
+ {{- site.data.locales[include.lang].post.read_time.unit -}}
31
+ </em>
26
32
  {%- if include.prompt -%}
27
33
  {%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
28
- {%- unless _prompt_words > 1 -%}{{ " " }}{%- endunless -%}{{ read_prompt }}
34
+ {%- unless _prompt_words > 1 -%}{{ ' ' }}{%- endunless -%}
35
+ {{ read_prompt }}
29
36
  {%- endif -%}
30
37
  </span>
@@ -1,6 +1,4 @@
1
- <!--
2
- Refactor the HTML structure.
3
- -->
1
+ <!-- Refactor the HTML structure -->
4
2
 
5
3
  {% assign _content = include.content %}
6
4
 
@@ -44,7 +42,6 @@
44
42
  {% endif %}
45
43
 
46
44
  <!-- images -->
47
-
48
45
  {% assign IMG_TAG = '<img ' %}
49
46
 
50
47
  {% if _content contains IMG_TAG %}
@@ -94,9 +91,9 @@
94
91
  {% continue %}
95
92
  {% endunless %}
96
93
 
97
- {% assign _pair = _attr | remove: '"' | split: '=' %}
94
+ {% assign _pair = _attr | split: '="' %}
98
95
  {% capture _key %}{{ _pair | first }}{% endcapture %}
99
- {% capture _value %}{{ _pair | last }}{% endcapture %}
96
+ {% capture _value %}{{ _pair | last | remove: '"' }}{% endcapture %}
100
97
 
101
98
  {% case _key %}
102
99
  {% when 'width' %}
@@ -110,7 +107,6 @@
110
107
  {% when 'class' %}
111
108
  {% assign _class = _value %}
112
109
  {% endcase %}
113
-
114
110
  {% endfor %}
115
111
 
116
112
  <!-- take out classes -->
@@ -162,28 +158,37 @@
162
158
  <!-- Bypass the HTML-proofer test -->
163
159
  {% assign _left = _left | append: ' data-proofer-ignore' %}
164
160
 
165
- <!-- make sure the `<img>` is wrapped by `<a>` -->
166
- {% assign _parent = _right | slice: 1, 4 %}
167
-
168
- {% if _parent == '</a>' %}
169
- <!-- add class to exist <a> tag -->
170
- {% assign _size = _img_content | size | minus: 1 %}
171
- {% capture _class %}
172
- class="img-link{% unless _lqip %} shimmer{% endunless %}"
173
- {% endcapture %}
174
- {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
175
-
176
- {% else %}
161
+ {% if page.layout == 'home' %}
177
162
  <!-- create the image wrapper -->
178
163
  {%- capture _wrapper_start -%}
179
- <a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
164
+ <div class="preview-img {{ _class | strip }}">
180
165
  {%- endcapture -%}
181
166
  {% assign _img_content = _img_content | append: _wrapper_start %}
182
- {% assign _right = _right | prepend: '></a' %}
167
+ {% assign _right = _right | prepend: '></div' %}
168
+
169
+ {% else %}
170
+ <!-- make sure the `<img>` is wrapped by `<a>` -->
171
+ {% assign _parent = _right | slice: 1, 4 %}
172
+
173
+ {% if _parent == '</a>' %}
174
+ <!-- add class to exist <a> tag -->
175
+ {% assign _size = _img_content | size | minus: 1 %}
176
+ {% capture _class %}
177
+ class="img-link{% unless _lqip %} shimmer{% endunless %}"
178
+ {% endcapture %}
179
+ {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
180
+ {% else %}
181
+ <!-- create the image wrapper -->
182
+ {%- capture _wrapper_start -%}
183
+ <a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
184
+ {%- endcapture -%}
185
+ {% assign _img_content = _img_content | append: _wrapper_start %}
186
+ {% assign _right = _right | prepend: '></a' %}
187
+ {% endif %}
183
188
  {% endif %}
184
189
 
185
190
  <!-- combine -->
186
- {% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
191
+ {% assign _img_content = _img_content | append: debug | append: IMG_TAG | append: _left | append: _right %}
187
192
 
188
193
  {% endfor %}
189
194
 
@@ -210,11 +215,11 @@
210
215
 
211
216
  {% if _left contains 'file="' %}
212
217
  {% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
213
- {% assign _label_icon = 'far fa-file-code' %}
218
+ {% assign _label_icon = 'far fa-file-code fa-fw' %}
214
219
  {% else %}
215
220
  {% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
216
221
  {% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
217
- {% assign _label_icon = 'fas fa-code small' %}
222
+ {% assign _label_icon = 'fas fa-code fa-fw small' %}
218
223
  {% endif %}
219
224
 
220
225
  {% capture _label %}
@@ -225,7 +230,7 @@
225
230
  | append: '<div class="code-header">'
226
231
  | append: _label
227
232
  | append: '<button aria-label="copy" data-title-succeed="'
228
- | append: site.data.locales[site.lang].post.button.copy_code.succeed
233
+ | append: site.data.locales[include.lang].post.button.copy_code.succeed
229
234
  | append: '"><i class="far fa-clipboard"></i></button></div>'
230
235
  | append: '<div class="highlight"><code>'
231
236
  %}
@@ -262,7 +267,7 @@
262
267
 
263
268
  {% assign left = snippet | split: mark_end | first %}
264
269
  {% assign right = snippet | slice: left.size, snippet.size %}
265
- {% assign left = left | replace_first: '">', '"><span class="mr-2">' | append: '</span>' %}
270
+ {% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
266
271
 
267
272
  {% assign _new_content = _new_content | append: mark_start
268
273
  | append: left | append: anchor | append: right
@@ -278,5 +283,4 @@
278
283
  {% assign _content = _heading_content %}
279
284
 
280
285
  <!-- return -->
281
-
282
286
  {{ _content }}
@@ -1,20 +1,20 @@
1
1
  <!--
2
- Recommend the other 3 posts according to the tags and categories of the current post,
3
- if the number is not enough, use the other latest posts to supplement.
2
+ Recommend the other 3 posts according to the tags and categories of the current post,
3
+ if the number is not enough, use the other latest posts to supplement.
4
4
  -->
5
5
 
6
- <!-- The total size of related posts -->
6
+ <!-- The total size of related posts -->
7
7
  {% assign TOTAL_SIZE = 3 %}
8
8
 
9
- <!-- An random integer that bigger than 0 -->
9
+ <!-- An random integer that bigger than 0 -->
10
10
  {% assign TAG_SCORE = 1 %}
11
11
 
12
- <!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
12
+ <!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
13
13
  {% assign CATEGORY_SCORE = 0.5 %}
14
14
 
15
- {% assign SEPARATOR = ":" %}
15
+ {% assign SEPARATOR = ':' %}
16
16
 
17
- {% assign score_list = "" | split: "" %}
17
+ {% assign score_list = '' | split: '' %}
18
18
  {% assign last_index = site.posts.size | minus: 1 %}
19
19
 
20
20
  {% for i in (0..last_index) %}
@@ -42,11 +42,9 @@
42
42
  {% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %}
43
43
  {% assign score_list = score_list | push: score_item %}
44
44
  {% endif %}
45
-
46
45
  {% endfor %}
47
46
 
48
-
49
- {% assign index_list = "" | split: "" %}
47
+ {% assign index_list = '' | split: '' %}
50
48
 
51
49
  {% if score_list.size > 0 %}
52
50
  {% assign score_list = score_list | sort | reverse %}
@@ -56,13 +54,13 @@
56
54
  {% endfor %}
57
55
  {% endif %}
58
56
 
59
- <!-- Fill with the other newlest posts -->
57
+ <!-- Fill with the other newlest posts -->
60
58
  {% assign less = TOTAL_SIZE | minus: index_list.size %}
61
59
 
62
60
  {% if less > 0 %}
63
61
  {% for i in (0..last_index) %}
64
62
  {% assign post = site.posts[i] %}
65
- {% if post.url != page.url %}
63
+ {% if post.url != page.url %}
66
64
  {% capture cur_index %}{{ i }}{% endcapture %}
67
65
  {% unless index_list contains cur_index %}
68
66
  {% assign index_list = index_list | push: cur_index %}
@@ -77,27 +75,30 @@
77
75
 
78
76
  {% if index_list.size > 0 %}
79
77
  <div id="related-posts" class="mb-2 mb-sm-4">
80
- <h3 class="pt-2 mb-4 ml-1"
81
- data-toc-skip>{{ site.data.locales[site.lang].post.relate_posts }}</h3>
82
- <div class="card-deck mb-4">
83
- {% for entry in index_list %}
84
- {% assign index = entry | plus: 0 %}
85
- {% assign post = site.posts[index] %}
86
- <div class="card">
87
- <a href="{{ post.url | relative_url }}">
88
- <div class="card-body">
89
- {% include datetime.html date=post.date class="small" %}
90
- <h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
91
- <div class="text-muted small">
92
- <p>
93
- {% include no-linenos.html content=post.content %}
94
- {{ content | markdownify | strip_html | truncate: 200 | escape }}
95
- </p>
78
+ <h3 class="pt-2 mb-4 ms-1" data-toc-skip>
79
+ {{ site.data.locales[include.lang].post.relate_posts }}
80
+ </h3>
81
+ <div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4">
82
+ {% for entry in index_list %}
83
+ {% assign index = entry | plus: 0 %}
84
+ {% assign post = site.posts[index] %}
85
+ <div class="col">
86
+ <a href="{{ post.url | relative_url }}" class="card post-preview h-100">
87
+ <div class="card-body">
88
+ {% include datetime.html date=post.date class="small" lang=include.lang %}
89
+ <h4 class="pt-0 my-2" data-toc-skip>{{ post.title }}</h4>
90
+ <div class="text-muted small">
91
+ <p>
92
+ {% include no-linenos.html content=post.content %}
93
+ {{ content | markdownify | strip_html | truncate: 200 | escape }}
94
+ </p>
95
+ </div>
96
96
  </div>
97
- </div>
98
- </a>
99
- </div>
100
- {% endfor %}
101
- </div> <!-- .card-deck -->
102
- </div> <!-- #related-posts -->
97
+ </a>
98
+ </div>
99
+ {% endfor %}
100
+ </div>
101
+ <!-- .card-deck -->
102
+ </div>
103
+ <!-- #related-posts -->
103
104
  {% endif %}
@@ -4,7 +4,7 @@
4
4
  -->
5
5
 
6
6
  {% capture result_elem %}
7
- <div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
7
+ <div class="px-1 px-sm-2 px-lg-4 px-xl-0">
8
8
  <a href="{url}">{title}</a>
9
9
  <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
10
10
  {categories}
@@ -14,33 +14,32 @@
14
14
  </div>
15
15
  {% endcapture %}
16
16
 
17
- {% capture not_found %}<p class="mt-5">{{ site.data.locales[site.lang].search.no_results }}</p>{% endcapture %}
18
-
19
- <script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>
17
+ {% capture not_found %}<p class="mt-5">{{ site.data.locales[include.lang].search.no_results }}</p>{% endcapture %}
20
18
 
21
19
  <script>
22
- SimpleJekyllSearch({
23
- searchInput: document.getElementById('search-input'),
24
- resultsContainer: document.getElementById('search-results'),
25
- json: '{{ '/assets/js/data/search.json' | relative_url }}',
26
- searchResultTemplate: '{{ result_elem | strip_newlines }}',
27
- noResultsText: '{{ not_found }}',
28
- templateMiddleware: function(prop, value, template) {
29
- if (prop === 'categories') {
30
- if (value === '') {
31
- return `${value}`;
32
- } else {
33
- return `<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
20
+ /* Note: dependent library will be loaded in `js-selector.html` */
21
+ SimpleJekyllSearch({
22
+ searchInput: document.getElementById('search-input'),
23
+ resultsContainer: document.getElementById('search-results'),
24
+ json: '{{ '/assets/js/data/search.json' | relative_url }}',
25
+ searchResultTemplate: '{{ result_elem | strip_newlines }}',
26
+ noResultsText: '{{ not_found }}',
27
+ templateMiddleware: function(prop, value, template) {
28
+ if (prop === 'categories') {
29
+ if (value === '') {
30
+ return `${value}`;
31
+ } else {
32
+ return `<div class="me-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
33
+ }
34
34
  }
35
- }
36
35
 
37
- if (prop === 'tags') {
38
- if (value === '') {
39
- return `${value}`;
40
- } else {
41
- return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
36
+ if (prop === 'tags') {
37
+ if (value === '') {
38
+ return `${value}`;
39
+ } else {
40
+ return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
41
+ }
42
42
  }
43
43
  }
44
- }
45
- });
44
+ });
46
45
  </script>
@@ -1,8 +1,7 @@
1
- <!--
2
- The Search results
3
- -->
1
+ <!-- The Search results -->
2
+
4
3
  <div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
5
- <div class="col-12 col-sm-11 post-content">
4
+ <div class="col-11 post-content">
6
5
  <div id="search-hints">
7
6
  {% include trending-tags.html %}
8
7
  </div>