jekyll-theme-chirpy 6.2.2 → 6.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,22 +30,22 @@
30
30
  {% endif %}
31
31
 
32
32
  <!-- Change the icon of checkbox -->
33
+
33
34
  {% if _content contains '<input type="checkbox"' %}
34
35
  {% assign _content = _content
35
- | replace:
36
- '<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:
39
- '<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
40
- '<i class="far fa-circle fa-fw"></i>'
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>'
41
40
  %}
42
41
  {% endif %}
43
42
 
44
- <!-- images -->
43
+ <!-- Handle images -->
44
+
45
45
  {% assign IMG_TAG = '<img ' %}
46
46
 
47
47
  {% if _content contains IMG_TAG %}
48
- {% assign _img_content = nil %}
48
+ {% assign _img_content = null %}
49
49
  {% assign _img_snippets = _content | split: IMG_TAG %}
50
50
 
51
51
  <!-- CDN URL -->
@@ -81,10 +81,9 @@
81
81
  {% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
82
82
  {% assign _attrs = _left | split: '" ' %}
83
83
 
84
- {% assign _width = nil %}
85
- {% assign _height = nil %}
86
- {% assign _lqip = nil %}
87
- {% assign _class = nil %}
84
+ {% assign _src = null %}
85
+ {% assign _lqip = null %}
86
+ {% assign _class = null %}
88
87
 
89
88
  {% for _attr in _attrs %}
90
89
  {% unless _attr contains '=' %}
@@ -96,10 +95,6 @@
96
95
  {% capture _value %}{{ _pair | last | remove: '"' }}{% endcapture %}
97
96
 
98
97
  {% case _key %}
99
- {% when 'width' %}
100
- {% assign _width = _value %}
101
- {% when 'height' %}
102
- {% assign _height = _value %}
103
98
  {% when 'src' %}
104
99
  {% assign _src = _value %}
105
100
  {% when 'lqip' %}
@@ -115,54 +110,40 @@
115
110
  {% assign _left = _left | remove: _old_class %}
116
111
  {% endif %}
117
112
 
118
- {% assign _final_src = nil %}
113
+ {% assign _final_src = null %}
114
+ {% assign _lazyload = true %}
119
115
 
120
116
  {% unless _src contains '//' %}
121
117
  {% assign _final_src = _path_prefix | append: _src %}
122
- {% capture _src_from %}"{{ _src }}"{% endcapture %}
123
- {% capture _src_to %}"{{ _final_src }}"{% endcapture %}
124
- {% assign _left = _left | replace: _src_from, _src_to %}
118
+ {% assign _src_alt = 'src="' | append: _path_prefix %}
119
+ {% assign _left = _left | replace: 'src="', _src_alt %}
125
120
  {% endunless %}
126
121
 
127
122
  {% if _lqip %}
128
- {% unless _lqip contains ':' %}
129
- {% assign _final_lqip = _path_prefix | append: _lqip %}
130
- {% capture _lqip_from %}"{{ _lqip }}"{% endcapture %}
131
- {% capture _lqip_to %}"{{ _final_lqip }}"{% endcapture %}
132
- {% assign _left = _left | replace: _lqip_from, _lqip_to %}
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 %}
133
129
  {% endunless %}
134
- {% endif %}
135
130
 
136
- <!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
137
- {% assign _left = _left | replace: 'src=', 'data-src=' %}
138
- {% if _left contains 'class=' %}
139
- {% assign _left = _left | replace: 'class="', 'class="lazyload '%}
140
- {% else %}
141
- {% assign _left = _left | append: ' class="lazyload"' %}
142
- {% endif %}
131
+ <!-- add image placeholder -->
132
+ {% assign _left = _left | replace: 'src=', 'data-src=' | replace: ' lqip=', ' data-lqip="true" src=' %}
143
133
 
144
- <!-- add image placeholder -->
145
- {% if _lqip %}
146
- {% assign _left = _left | replace: ' lqip=', ' data-lqip="true" src=' %}
147
134
  {% else %}
148
- {% if _width and _height %}
149
- <!-- add SVG placehoder -->
150
- {%- capture _svg -%}
151
- src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
152
- {%- endcapture -%}
153
- {% assign _left = _svg | append: ' ' | append: _left %}
154
- {% assign _class = _class | append: ' shimmer' %}
155
- {% endif %}
135
+ {% assign _class = _class | append: ' shimmer' %}
156
136
  {% endif %}
157
137
 
158
- <!-- Bypass the HTML-proofer test -->
159
- {% assign _left = _left | append: ' data-proofer-ignore' %}
138
+ <!-- lazy-load images -->
139
+ {% if _lazyload %}
140
+ {% assign _left = _left | append: ' loading="lazy"' %}
141
+ {% endif %}
160
142
 
161
143
  {% if page.layout == 'home' %}
162
144
  <!-- create the image wrapper -->
163
- {%- capture _wrapper_start -%}
164
- <div class="preview-img {{ _class | strip }}">
165
- {%- endcapture -%}
145
+ {% assign _wrapper_start = '<div class="preview-img ' | append: _class | append: '">' %}
146
+
166
147
  {% assign _img_content = _img_content | append: _wrapper_start %}
167
148
  {% assign _right = _right | prepend: '></div' %}
168
149
 
@@ -176,26 +157,30 @@
176
157
  {% capture _class %}
177
158
  class="img-link{% unless _lqip %} shimmer{% endunless %}"
178
159
  {% endcapture %}
179
- {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
160
+ {% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
161
+
180
162
  {% else %}
181
163
  <!-- create the image wrapper -->
182
- {%- capture _wrapper_start -%}
183
- <a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
184
- {%- endcapture -%}
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
+
185
172
  {% assign _img_content = _img_content | append: _wrapper_start %}
186
- {% assign _right = _right | prepend: '></a' %}
173
+ {% assign _right = '></a' | append: _right %}
187
174
  {% endif %}
188
175
  {% endif %}
189
176
 
190
177
  <!-- combine -->
191
- {% assign _img_content = _img_content | append: debug | append: IMG_TAG | append: _left | append: _right %}
192
-
178
+ {% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
193
179
  {% endfor %}
194
180
 
195
181
  {% if _img_content %}
196
182
  {% assign _content = _img_content %}
197
183
  {% endif %}
198
-
199
184
  {% endif %}
200
185
 
201
186
  <!-- Add header for code snippets -->
@@ -205,13 +190,11 @@
205
190
  {% assign _new_content = '' %}
206
191
 
207
192
  {% for _snippet in _code_spippets %}
208
-
209
193
  {% if forloop.last %}
210
194
  {% assign _new_content = _new_content | append: _snippet %}
211
195
 
212
196
  {% else %}
213
-
214
- {% assign _left = _snippet | split: '><' | last%}
197
+ {% assign _left = _snippet | split: '><' | last %}
215
198
 
216
199
  {% if _left contains 'file="' %}
217
200
  {% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
@@ -226,21 +209,19 @@
226
209
  <span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
227
210
  {% endcapture %}
228
211
 
229
- {% assign _new_content = _new_content | append: _snippet
230
- | append: '<div class="code-header">'
231
- | append: _label
232
- | append: '<button aria-label="copy" data-title-succeed="'
233
- | append: site.data.locales[include.lang].post.button.copy_code.succeed
234
- | append: '"><i class="far fa-clipboard"></i></button></div>'
235
- | append: '<div class="highlight"><code>'
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>'
236
220
  %}
237
-
238
221
  {% endif %}
239
-
240
222
  {% endfor %}
241
223
 
242
224
  {% assign _content = _new_content %}
243
-
244
225
  {% endif %}
245
226
 
246
227
  <!-- Create heading anchors -->
@@ -249,11 +230,11 @@
249
230
  {% assign _heading_content = _content %}
250
231
 
251
232
  {% for level in heading_levels %}
252
- {% capture mark_start %}<h{{ level }} id="{% endcapture %}
253
- {% capture mark_end %}</h{{ level }}>{% endcapture %}
233
+ {% assign mark_start = '<h' | append: level | append: ' id="' %}
234
+ {% assign mark_end = '</h' | append: level | append: '>' %}
254
235
 
255
236
  {% if _heading_content contains mark_start %}
256
- {% assign _new_content = nil %}
237
+ {% assign _new_content = null %}
257
238
  {% assign heading_snippets = _heading_content | split: mark_start %}
258
239
 
259
240
  {% for snippet in heading_snippets %}
@@ -263,20 +244,19 @@
263
244
  {% endif %}
264
245
 
265
246
  {% assign id = snippet | split: '"' | first %}
266
- {% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
247
+ {% assign anchor = '<a href="#'
248
+ | append: id
249
+ | append: '" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>'
250
+ %}
267
251
 
268
252
  {% assign left = snippet | split: mark_end | first %}
269
253
  {% assign right = snippet | slice: left.size, snippet.size %}
270
254
  {% assign left = left | replace_first: '">', '"><span class="me-2">' | append: '</span>' %}
271
255
 
272
- {% assign _new_content = _new_content | append: mark_start
273
- | append: left | append: anchor | append: right
274
- %}
275
-
256
+ {% assign _new_content = _new_content | append: mark_start | append: left | append: anchor | append: right %}
276
257
  {% endfor %}
277
258
 
278
259
  {% assign _heading_content = _new_content %}
279
-
280
260
  {% endif %}
281
261
  {% endfor %}
282
262
 
@@ -78,9 +78,9 @@
78
78
  <article class="col">
79
79
  <a href="{{ post.url | relative_url }}" class="post-preview card h-100">
80
80
  <div class="card-body">
81
- {% include datetime.html date=post.date class="small" lang=include.lang %}
81
+ {% include datetime.html date=post.date lang=include.lang %}
82
82
  <h4 class="pt-0 my-2">{{ post.title }}</h4>
83
- <div class="text-muted small">
83
+ <div class="text-muted">
84
84
  <p>
85
85
  {% include no-linenos.html content=post.content %}
86
86
  {{ content | markdownify | strip_html | truncate: 200 | escape }}
data/_includes/toc.html CHANGED
@@ -6,7 +6,7 @@
6
6
  {% endif %}
7
7
 
8
8
  {% if enable_toc %}
9
- <section id="toc-wrapper" class="ps-0 pe-4 mb-5">
9
+ <section id="toc-wrapper" class="ps-0 pe-4">
10
10
  <h2 class="panel-heading ps-3 pt-2 mb-2">{{- site.data.locales[include.lang].panel.toc -}}</h2>
11
11
  <nav id="toc"></nav>
12
12
  </section>
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  layout: compress
3
- # Default layout
4
3
  ---
5
4
 
6
5
  <!doctype html>
@@ -9,14 +8,8 @@ layout: compress
9
8
 
10
9
  {% include lang.html %}
11
10
 
12
- {% capture prefer_mode %}
13
- {% if site.theme_mode %}
14
- data-mode="{{ site.theme_mode }}"
15
- {% endif %}
16
- {% endcapture %}
17
-
18
- {% if layout.tail_includes %}
19
- {% assign has_tail = true %}
11
+ {% if site.theme_mode %}
12
+ {% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %}
20
13
  {% endif %}
21
14
 
22
15
  <!-- `site.alt_lang` can specify a language different from the UI -->
@@ -27,19 +20,20 @@ layout: compress
27
20
  {% include sidebar.html lang=lang %}
28
21
 
29
22
  <div id="main-wrapper" class="d-flex justify-content-center">
30
- <div class="container px-xxl-5">
23
+ <div class="container d-flex flex-column px-xxl-5">
31
24
  {% include topbar.html lang=lang %}
32
25
 
33
- <div class="row">
34
- <main
35
- aria-label="Main Content"
36
- class="col-12 col-lg-11 col-xl-9 px-md-4{% unless has_tail %} pb-5{% endunless %}"
37
- >
38
- {{ content }}
26
+ <div class="row flex-grow-1">
27
+ <main aria-label="Main Content" class="col-12 col-lg-11 col-xl-9 px-md-4">
28
+ {% if layout.refactor or layout.layout == 'default' %}
29
+ {% include refactor-content.html content=content lang=lang %}
30
+ {% else %}
31
+ {{ content }}
32
+ {% endif %}
39
33
  </main>
40
34
 
41
35
  <!-- panel -->
42
- <aside aria-label="Panel" id="panel-wrapper" class="col-xl-3 ps-2 text-muted">
36
+ <aside aria-label="Panel" id="panel-wrapper" class="col-xl-3 ps-2 mb-5 text-muted">
43
37
  <div class="access">
44
38
  {% include_cached update-list.html lang=lang %}
45
39
  {% include_cached trending-tags.html lang=lang %}
@@ -55,12 +49,10 @@ layout: compress
55
49
  <div class="row">
56
50
  <!-- tail -->
57
51
  <div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 px-md-4">
58
- {% if has_tail %}
59
- {% for _include in layout.tail_includes %}
60
- {% assign _include_path = _include | append: '.html' %}
61
- {% include {{ _include_path }} lang=lang %}
62
- {% endfor %}
63
- {% endif %}
52
+ {% for _include in layout.tail_includes %}
53
+ {% assign _include_path = _include | append: '.html' %}
54
+ {% include {{ _include_path }} lang=lang %}
55
+ {% endfor %}
64
56
 
65
57
  {% include_cached footer.html lang=lang %}
66
58
  </div>
data/_layouts/home.html CHANGED
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  layout: default
3
+ refactor: true
3
4
  ---
4
5
 
5
6
  {% include lang.html %}
@@ -39,15 +40,13 @@ layout: default
39
40
  {% endfor %}
40
41
  {% endif %}
41
42
 
42
- {% capture content %}
43
+ <div id="post-list" class="flex-grow-1 px-xl-1">
43
44
  {% for post in posts %}
44
- <article class="card-wrapper">
45
- <a href="{{ post.url | relative_url }}" class="card post-preview flex-md-row-reverse">
46
- {% if post.image %}
47
- {% if post.image.lqip %}
48
- {% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
49
- {% endif %}
45
+ <article class="card-wrapper card">
46
+ <a href="{{ post.url | relative_url }}" class="post-preview row g-0 flex-md-row-reverse">
47
+ {% assign card_body_col = '12' %}
50
48
 
49
+ {% if post.image %}
51
50
  {% assign src = post.image.path | default: post.image %}
52
51
  {% unless src contains '//' %}
53
52
  {% assign src = post.img_path | append: '/' | append: src | replace: '//', '/' %}
@@ -55,54 +54,62 @@ layout: default
55
54
 
56
55
  {% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
57
56
 
58
- <img src="{{ src }}" w="17" h="10" alt="{{ alt }}" {{ lqip }}>
59
- {% endif %}
57
+ {% assign lqip = null %}
60
58
 
61
- <div class="card-body d-flex flex-column">
62
- <h1 class="card-title my-2 mt-md-0">{{ post.title }}</h1>
59
+ {% if post.image.lqip %}
60
+ {% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
61
+ {% endif %}
63
62
 
64
- <div class="card-text content mt-0 mb-2">
65
- <p>
66
- {% include no-linenos.html content=post.content %}
67
- {{ content | markdownify | strip_html | truncate: 200 | escape }}
68
- </p>
63
+ <div class="col-md-5">
64
+ <img src="{{ src }}" alt="{{ alt }}" {{ lqip }}>
69
65
  </div>
70
66
 
71
- <div class="post-meta flex-grow-1 d-flex align-items-end">
72
- <div class="me-auto">
73
- <!-- posted date -->
74
- <i class="far fa-calendar fa-fw me-1"></i>
75
- {% include datetime.html date=post.date lang=lang %}
76
-
77
- <!-- categories -->
78
- {% if post.categories.size > 0 %}
79
- <i class="far fa-folder-open fa-fw me-1"></i>
80
- <span class="categories">
81
- {% for category in post.categories %}
82
- {{ category }}
83
- {%- unless forloop.last -%},{%- endunless -%}
84
- {% endfor %}
85
- </span>
86
- {% endif %}
67
+ {% assign card_body_col = '7' %}
68
+ {% endif %}
69
+
70
+ <div class="col-md-{{ card_body_col }}">
71
+ <div class="card-body d-flex flex-column">
72
+ <h1 class="card-title my-2 mt-md-0">{{ post.title }}</h1>
73
+
74
+ <div class="card-text content mt-0 mb-3">
75
+ <p>
76
+ {% include no-linenos.html content=post.content %}
77
+ {{ content | markdownify | strip_html | truncate: 200 | escape }}
78
+ </p>
87
79
  </div>
88
80
 
89
- {% if post.pin %}
90
- <div class="pin ms-1">
91
- <i class="fas fa-thumbtack fa-fw"></i>
92
- <span>{{ site.data.locales[lang].post.pin_prompt }}</span>
81
+ <div class="post-meta flex-grow-1 d-flex align-items-end">
82
+ <div class="me-auto">
83
+ <!-- posted date -->
84
+ <i class="far fa-calendar fa-fw me-1"></i>
85
+ {% include datetime.html date=post.date lang=lang %}
86
+
87
+ <!-- categories -->
88
+ {% if post.categories.size > 0 %}
89
+ <i class="far fa-folder-open fa-fw me-1"></i>
90
+ <span class="categories">
91
+ {% for category in post.categories %}
92
+ {{ category }}
93
+ {%- unless forloop.last -%},{%- endunless -%}
94
+ {% endfor %}
95
+ </span>
96
+ {% endif %}
93
97
  </div>
94
- {% endif %}
98
+
99
+ {% if post.pin %}
100
+ <div class="pin ms-1">
101
+ <i class="fas fa-thumbtack fa-fw"></i>
102
+ <span>{{ site.data.locales[lang].post.pin_prompt }}</span>
103
+ </div>
104
+ {% endif %}
105
+ </div>
106
+ <!-- .post-meta -->
95
107
  </div>
96
- <!-- .post-meta -->
108
+ <!-- .card-body -->
97
109
  </div>
98
- <!-- .card-body -->
99
110
  </a>
100
111
  </article>
101
112
  {% endfor %}
102
- {% endcapture %}
103
-
104
- <div id="post-list" class="flex-grow-1 pe-xl-2">
105
- {% include refactor-content.html content=content lang=lang %}
106
113
  </div>
107
114
  <!-- #post-list -->
108
115
 
data/_layouts/page.html CHANGED
@@ -2,13 +2,7 @@
2
2
  layout: default
3
3
  ---
4
4
 
5
- {% capture _content %}
6
- {% if layout.refactor or page.layout == 'page' %}
7
- {% include refactor-content.html content=content lang=lang %}
8
- {% else %}
9
- {{ content }}
10
- {% endif %}
11
- {% endcapture %}
5
+ {% include lang.html %}
12
6
 
13
7
  <article class="px-1">
14
8
  {% if page.layout == 'page' or page.collection == 'tabs' %}
@@ -18,9 +12,9 @@ layout: default
18
12
  {{ title }}
19
13
  </h1>
20
14
  <div class="content">
21
- {{ _content }}
15
+ {{ content }}
22
16
  </div>
23
17
  {% else %}
24
- {{ _content }}
18
+ {{ content }}
25
19
  {% endif %}
26
20
  </article>