jekyll-theme-chirpy 5.3.1 → 5.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/_data/assets/cross_origin.yml +15 -15
- data/_data/assets/self_host.yml +3 -3
- data/_data/contact.yml +1 -1
- data/_data/locales/bg-BG.yml +3 -3
- data/_data/locales/en.yml +1 -1
- data/_includes/comments/disqus.html +11 -11
- data/_includes/embed/twitch.html +4 -0
- data/_includes/embed/youtube.html +6 -0
- data/_includes/footer.html +5 -5
- data/_includes/head.html +14 -10
- data/_includes/js-selector.html +1 -2
- data/_includes/mermaid.html +12 -10
- data/_includes/post-sharing.html +0 -1
- data/_includes/refactor-content.html +97 -53
- data/_includes/sidebar.html +11 -1
- data/_layouts/post.html +12 -21
- data/_sass/addon/commons.scss +143 -77
- data/_sass/addon/module.scss +12 -3
- data/_sass/addon/syntax.scss +4 -12
- data/_sass/colors/dark-typography.scss +16 -3
- data/_sass/colors/light-typography.scss +12 -1
- data/_sass/jekyll-theme-chirpy.scss +1 -1
- data/_sass/layout/post.scss +22 -4
- data/assets/feed.xml +1 -1
- data/assets/js/data/search.json +3 -1
- data/assets/js/dist/categories.min.js +1 -1
- data/assets/js/dist/commons.min.js +1 -1
- data/assets/js/dist/home.min.js +1 -1
- data/assets/js/dist/misc.min.js +1 -1
- data/assets/js/dist/page.min.js +2 -2
- data/assets/js/dist/post.min.js +2 -2
- data/assets/js/dist/pvreport.min.js +1 -1
- metadata +14 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32212ead4cede51287719a6df2db4ca1b4cf74cfbedc5614f9a968247d492546
|
4
|
+
data.tar.gz: 77f9aa0fdf8dd3d67a7c79b4aef5d4f9f15a53b5a6760ae42832c8b9c7216650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7004962eddbeec0c295fc5bff0644a4e08c0162a7572d5bbe04e17aca72ba57da12bdea70e0799a94c9cc4367c372be1eb6850ecb80dc449ad9eb2c1366b797b
|
7
|
+
data.tar.gz: 4c7a15af9ab52c7af0b0631edb58998ba465715c69a49966b37667076e6a6ad09648fa46b19895c65236f537830a4798f54f7b07bc0b4dd7ed7b77298d216cd0
|
data/README.md
CHANGED
@@ -12,30 +12,31 @@
|
|
12
12
|
|
13
13
|
[**Live Demo →**](https://cotes2020.github.io/chirpy-demo)
|
14
14
|
|
15
|
-
[![Devices Mockup](https://
|
15
|
+
[![Devices Mockup](https://chirpy-img.netlify.app/commons/devices-mockup.png)](https://cotes2020.github.io/chirpy-demo)
|
16
16
|
|
17
17
|
</div>
|
18
18
|
|
19
19
|
## Features
|
20
20
|
|
21
|
-
- Localized Layout
|
22
21
|
- Dark/Light Theme Mode
|
22
|
+
- Localized UI language
|
23
23
|
- Pinned Posts
|
24
24
|
- Hierarchical Categories
|
25
|
-
-
|
25
|
+
- Trending Tags
|
26
26
|
- Table of Contents
|
27
|
-
-
|
27
|
+
- Last Modified Date of Posts
|
28
28
|
- Syntax Highlighting
|
29
29
|
- Mathematical Expressions
|
30
30
|
- Mermaid Diagram & Flowchart
|
31
|
+
- Dark/Light Mode Images
|
32
|
+
- Embed Videos
|
31
33
|
- Disqus/Utterances/Giscus Comments
|
32
34
|
- Search
|
33
35
|
- Atom Feeds
|
34
36
|
- Google Analytics
|
35
|
-
-
|
37
|
+
- Page Views Reporting
|
36
38
|
- SEO & Performance Optimization
|
37
39
|
|
38
|
-
|
39
40
|
## Quick Start
|
40
41
|
|
41
42
|
Before starting, please follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed.
|
@@ -102,4 +103,4 @@ This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chi
|
|
102
103
|
<!-- ReadMe links -->
|
103
104
|
|
104
105
|
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
105
|
-
[cn-donation]: https://
|
106
|
+
[cn-donation]: https://sponsor.cotes.page/
|
@@ -16,47 +16,47 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:w
|
|
16
16
|
# Libraries
|
17
17
|
|
18
18
|
jquery:
|
19
|
-
js: https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
|
19
|
+
js: https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js
|
20
20
|
|
21
21
|
bootstrap:
|
22
|
-
css: https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css
|
23
|
-
js: https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.bundle.min.js
|
22
|
+
css: https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css
|
23
|
+
js: https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js
|
24
24
|
|
25
25
|
bootstrap-toc:
|
26
26
|
css: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css
|
27
27
|
js: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js
|
28
28
|
|
29
29
|
fontawesome:
|
30
|
-
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@
|
30
|
+
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.1/css/all.min.css
|
31
31
|
|
32
32
|
search:
|
33
33
|
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
|
34
34
|
|
35
35
|
mermaid:
|
36
|
-
js: https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.min.js
|
36
|
+
js: https://cdn.jsdelivr.net/npm/mermaid@9.2.2/dist/mermaid.min.js
|
37
37
|
|
38
38
|
dayjs:
|
39
39
|
js:
|
40
|
-
common: https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js
|
41
|
-
locale: https://cdn.jsdelivr.net/npm/dayjs@1/locale/:LOCALE.min.js
|
42
|
-
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.min.js
|
43
|
-
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1/plugin/localizedFormat.min.js
|
40
|
+
common: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/dayjs.min.js
|
41
|
+
locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/locale/:LOCALE.min.js
|
42
|
+
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/relativeTime.min.js
|
43
|
+
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/localizedFormat.min.js
|
44
44
|
|
45
45
|
countup:
|
46
46
|
js: https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js
|
47
47
|
|
48
48
|
magnific-popup:
|
49
|
-
css: https://cdn.jsdelivr.net/npm/magnific-popup@1/dist/magnific-popup.min.css
|
50
|
-
js: https://cdn.jsdelivr.net/npm/magnific-popup@1/dist/jquery.magnific-popup.min.js
|
49
|
+
css: https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css
|
50
|
+
js: https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/jquery.magnific-popup.min.js
|
51
51
|
|
52
|
-
|
53
|
-
js: https://cdn.jsdelivr.net/npm/
|
52
|
+
lazysizes:
|
53
|
+
js: https://cdn.jsdelivr.net/npm/lazysizes@5.3.2/lazysizes.min.js
|
54
54
|
|
55
55
|
clipboard:
|
56
|
-
js: https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js
|
56
|
+
js: https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js
|
57
57
|
|
58
58
|
polyfill:
|
59
59
|
js: https://polyfill.io/v3/polyfill.min.js?features=es6
|
60
60
|
|
61
61
|
mathjax:
|
62
|
-
js: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js
|
62
|
+
js: https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml.js
|
data/_data/assets/self_host.yml
CHANGED
@@ -16,7 +16,7 @@ bootstrap-toc:
|
|
16
16
|
js: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js
|
17
17
|
|
18
18
|
fontawesome:
|
19
|
-
css: /assets/lib/fontawesome-free-
|
19
|
+
css: /assets/lib/fontawesome-free-6.2.1/css/all.min.css
|
20
20
|
|
21
21
|
search:
|
22
22
|
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js
|
@@ -38,8 +38,8 @@ magnific-popup:
|
|
38
38
|
css: /assets/lib/magnific-popup-1.1.0/magnific-popup.css
|
39
39
|
js: /assets/lib/magnific-popup-1.1.0/jquery.magnific-popup.min.js
|
40
40
|
|
41
|
-
|
42
|
-
js: /assets/lib/
|
41
|
+
lazysizes:
|
42
|
+
js: /assets/lib/lazysizes-5.3.2/lazysizes.min.js
|
43
43
|
|
44
44
|
clipboard:
|
45
45
|
js: /assets/lib/clipboard-2.0.9/clipboard.min.js
|
data/_data/contact.yml
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
# -
|
20
20
|
# type: mastodon
|
21
21
|
# icon: 'fab fa-mastodon' # icons powered by <https://fontawesome.com/>
|
22
|
-
# url: '' # Fill with your
|
22
|
+
# url: '' # Fill with your Mastodon account page, rel="me" will be applied for verification
|
23
23
|
# -
|
24
24
|
# type: linkedin
|
25
25
|
# icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
|
data/_data/locales/bg-BG.yml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
layout:
|
6
6
|
post: Публикация
|
7
7
|
category: Категория
|
8
|
-
tag:
|
8
|
+
tag: Таг
|
9
9
|
|
10
10
|
# The tabs of sidebar
|
11
11
|
tabs:
|
@@ -43,7 +43,7 @@ copyright:
|
|
43
43
|
meta: Създадено чрез :PLATFORM и :THEME тема.
|
44
44
|
|
45
45
|
not_found:
|
46
|
-
statment: Съжалявам, но
|
46
|
+
statment: Съжалявам, но на този URL адрес няма налично съдържание.
|
47
47
|
|
48
48
|
notification:
|
49
49
|
update_found: Налична е нова версия на съдържанието.
|
@@ -71,7 +71,7 @@ post:
|
|
71
71
|
title: Копирай линк
|
72
72
|
succeed: Линкът е копиран успешно!
|
73
73
|
# pinned prompt of posts list on homepage
|
74
|
-
pin_prompt: Прикрепен
|
74
|
+
pin_prompt: Прикрепенa
|
75
75
|
|
76
76
|
# categories page
|
77
77
|
categories:
|
data/_data/locales/en.yml
CHANGED
@@ -40,7 +40,7 @@ copyright:
|
|
40
40
|
Except where otherwise noted, the blog posts on this site are licensed
|
41
41
|
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
|
42
42
|
|
43
|
-
meta:
|
43
|
+
meta: Using the :PLATFORM theme :THEME.
|
44
44
|
|
45
45
|
not_found:
|
46
46
|
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
|
@@ -15,7 +15,6 @@
|
|
15
15
|
};
|
16
16
|
|
17
17
|
/* Lazy loading */
|
18
|
-
|
19
18
|
var disqus_observer = new IntersectionObserver(function (entries) {
|
20
19
|
if(entries[0].isIntersecting) {
|
21
20
|
(function () {
|
@@ -32,23 +31,24 @@
|
|
32
31
|
disqus_observer.observe(document.querySelector('#disqus_thread'));
|
33
32
|
|
34
33
|
/* Auto switch theme */
|
35
|
-
|
36
34
|
function reloadDisqus() {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
if (event.source === window && event.data &&
|
36
|
+
event.data.direction === ModeToggle.ID) {
|
37
|
+
/* Disqus hasn't been loaded */
|
38
|
+
if (typeof DISQUS === "undefined") {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
if (document.readyState == 'complete') {
|
43
|
+
DISQUS.reset({ reload: true, config: disqus_config });
|
44
|
+
}
|
44
45
|
}
|
45
46
|
}
|
46
47
|
|
47
48
|
const modeToggle = document.querySelector(".mode-toggle");
|
48
49
|
|
49
50
|
if (typeof modeToggle !== "undefined") {
|
50
|
-
|
51
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
|
51
|
+
window.addEventListener("message", reloadDisqus);
|
52
52
|
}
|
53
53
|
|
54
54
|
</script>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<iframe class="embed-video youtube lazyload"
|
2
|
+
src="https://www.youtube.com/embed/{{ include.id }}"
|
3
|
+
title="YouTube video player"
|
4
|
+
frameborder="0"
|
5
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
6
|
+
allowfullscreen></iframe>
|
data/_includes/footer.html
CHANGED
@@ -17,16 +17,16 @@
|
|
17
17
|
<div class="footer-right">
|
18
18
|
<p class="mb-0">
|
19
19
|
|
20
|
-
{
|
20
|
+
{%- capture _platform -%}
|
21
21
|
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
|
22
|
-
{
|
22
|
+
{%- endcapture -%}
|
23
23
|
|
24
|
-
{
|
24
|
+
{%- capture _theme -%}
|
25
25
|
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
|
26
|
-
{
|
26
|
+
{%- endcapture -%}
|
27
27
|
|
28
28
|
{{ site.data.locales[site.lang].meta
|
29
|
-
| default: '
|
29
|
+
| default: 'Using the :PLATFORM theme :THEME.'
|
30
30
|
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
|
31
31
|
}}
|
32
32
|
</p>
|
data/_includes/head.html
CHANGED
@@ -22,23 +22,27 @@
|
|
22
22
|
{% seo title=false %}
|
23
23
|
{% endcapture %}
|
24
24
|
|
25
|
-
{% if
|
26
|
-
{% assign
|
25
|
+
{% if page.image %}
|
26
|
+
{% assign img = page.image.path | default: page.image %}
|
27
|
+
|
28
|
+
{% unless img contains '://' %}
|
29
|
+
{% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
|
30
|
+
{% capture target %}"{{ img | absolute_url }}"{% endcapture %}
|
27
31
|
|
28
|
-
{% for prop in properties %}
|
29
32
|
{% if site.img_cdn contains '//' %}
|
30
|
-
<!--
|
31
|
-
{% capture
|
32
|
-
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{% endcapture %}
|
33
|
+
<!-- it's a cross-origin URL -->
|
34
|
+
{% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
|
33
35
|
{% else %}
|
34
|
-
<!--
|
35
|
-
{
|
36
|
-
|
36
|
+
<!-- it's a local file path -->
|
37
|
+
{%- capture replacement -%}
|
38
|
+
"{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
|
39
|
+
{%- endcapture -%}
|
37
40
|
{% endif %}
|
38
41
|
|
39
42
|
{% assign seo_tags = seo_tags | replace: target, replacement %}
|
40
43
|
|
41
|
-
{%
|
44
|
+
{% endunless %}
|
45
|
+
|
42
46
|
{% endif %}
|
43
47
|
|
44
48
|
{{ seo_tags }}
|
data/_includes/js-selector.html
CHANGED
@@ -15,12 +15,11 @@
|
|
15
15
|
{% if page.layout == 'post' or page.layout == 'page' %}
|
16
16
|
<!-- image lazy-loading & popup & clipboard -->
|
17
17
|
{% assign _urls = site.data.assets[origin].magnific-popup.js
|
18
|
-
| append: ',' | append: site.data.assets[origin].
|
18
|
+
| append: ',' | append: site.data.assets[origin].lazysizes.js
|
19
19
|
| append: ',' | append: site.data.assets[origin].clipboard.js
|
20
20
|
%}
|
21
21
|
|
22
22
|
{% include jsdelivr-combine.html urls=_urls %}
|
23
|
-
|
24
23
|
{% endif %}
|
25
24
|
|
26
25
|
{% if page.layout == 'home'
|
data/_includes/mermaid.html
CHANGED
@@ -5,10 +5,11 @@
|
|
5
5
|
<script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script>
|
6
6
|
|
7
7
|
<script>
|
8
|
-
|
8
|
+
(function () {
|
9
|
+
|
9
10
|
function updateMermaid(event) {
|
10
11
|
if (event.source === window && event.data &&
|
11
|
-
|
12
|
+
event.data.direction === ModeToggle.ID) {
|
12
13
|
|
13
14
|
const mode = event.data.message;
|
14
15
|
|
@@ -16,11 +17,11 @@
|
|
16
17
|
return;
|
17
18
|
}
|
18
19
|
|
19
|
-
let expectedTheme = (mode === ModeToggle.DARK_MODE? "dark" : "default");
|
20
|
-
let config = {
|
20
|
+
let expectedTheme = (mode === ModeToggle.DARK_MODE ? "dark" : "default");
|
21
|
+
let config = {theme: expectedTheme};
|
21
22
|
|
22
23
|
/* Re-render the SVG › <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
|
23
|
-
$(".mermaid").each(function() {
|
24
|
+
$(".mermaid").each(function () {
|
24
25
|
let svgCode = $(this).prev().children().html();
|
25
26
|
$(this).removeAttr("data-processed");
|
26
27
|
$(this).html(svgCode);
|
@@ -35,7 +36,7 @@
|
|
35
36
|
|
36
37
|
if ($("html[data-mode=dark]").length > 0
|
37
38
|
|| ($("html[data-mode]").length == 0
|
38
|
-
&& window.matchMedia("(prefers-color-scheme: dark)").matches
|
39
|
+
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
|
39
40
|
initTheme = "dark";
|
40
41
|
}
|
41
42
|
|
@@ -43,15 +44,16 @@
|
|
43
44
|
theme: initTheme /* <default|dark|forest|neutral> */
|
44
45
|
};
|
45
46
|
|
46
|
-
/*
|
47
|
-
$("pre").has("code.language-mermaid").each(function() {
|
47
|
+
/* Create mermaid tag */
|
48
|
+
$("pre").has("code.language-mermaid").each(function () {
|
48
49
|
let svgCode = $(this).children().html();
|
49
50
|
$(this).addClass("unloaded");
|
50
|
-
$(this).after(`<
|
51
|
+
$(this).after(`<pre class=\"mermaid\">${svgCode}</pre>`);
|
51
52
|
});
|
52
53
|
|
53
54
|
mermaid.initialize(mermaidConf);
|
54
55
|
|
55
56
|
window.addEventListener("message", updateMermaid);
|
56
|
-
});
|
57
|
+
})();
|
58
|
+
|
57
59
|
</script>
|
data/_includes/post-sharing.html
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
<span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share }}</span>
|
7
7
|
<span class="share-icons">
|
8
8
|
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
9
|
-
{% assign title = title | url_encode %}
|
10
9
|
{% assign url = page.url | absolute_url | url_encode %}
|
11
10
|
|
12
11
|
{% for share in site.data.share.platforms %}
|
@@ -51,31 +51,52 @@
|
|
51
51
|
{% assign _img_content = nil %}
|
52
52
|
{% assign _img_snippets = _content | split: IMG_TAG %}
|
53
53
|
|
54
|
+
<!-- CDN URL -->
|
55
|
+
{% if site.img_cdn %}
|
56
|
+
{% if site.img_cdn contains '//' %}
|
57
|
+
{% assign _path_prefix = site.img_cdn %}
|
58
|
+
{% else %}
|
59
|
+
{% assign _path_prefix = site.img_cdn | relative_url %}
|
60
|
+
{% endif %}
|
61
|
+
{% else %}
|
62
|
+
{% assign _path_prefix = site.baseurl %}
|
63
|
+
{% endif %}
|
64
|
+
|
65
|
+
<!-- Add image path -->
|
66
|
+
{% if page.img_path %}
|
67
|
+
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
|
68
|
+
{% assign _path_prefix = _path_prefix | append: _path %}
|
69
|
+
{% endif %}
|
70
|
+
|
54
71
|
{% for _img_snippet in _img_snippets %}
|
55
72
|
{% if forloop.first %}
|
56
73
|
{% assign _img_content = _img_snippet %}
|
57
74
|
{% continue %}
|
58
75
|
{% endif %}
|
59
76
|
|
60
|
-
{% assign _width = nil %}
|
61
|
-
{% assign _height = nil %}
|
62
|
-
{% assign _src = nil %}
|
63
|
-
|
64
77
|
{% assign _left = _img_snippet | split: '>' | first %}
|
65
78
|
{% assign _right = _img_snippet | remove: _left %}
|
66
79
|
|
67
|
-
{%
|
68
|
-
|
69
|
-
{%
|
80
|
+
{% unless _left contains 'src=' %}
|
81
|
+
{% continue %}
|
82
|
+
{% endunless %}
|
83
|
+
|
84
|
+
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
85
|
+
{% assign _attrs = _left | split: '" ' %}
|
86
|
+
|
87
|
+
{% assign _width = nil %}
|
88
|
+
{% assign _height = nil %}
|
89
|
+
{% assign _lqip = nil %}
|
90
|
+
{% assign _class = nil %}
|
70
91
|
|
71
92
|
{% for _attr in _attrs %}
|
72
|
-
{%
|
73
|
-
{% if _pair.size < 2 %}
|
93
|
+
{% unless _attr contains '=' %}
|
74
94
|
{% continue %}
|
75
|
-
{%
|
95
|
+
{% endunless %}
|
76
96
|
|
97
|
+
{% assign _pair = _attr | remove: '"' | split: '=' %}
|
77
98
|
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
78
|
-
{% capture _value %}{{ _pair | last
|
99
|
+
{% capture _value %}{{ _pair | last }}{% endcapture %}
|
79
100
|
|
80
101
|
{% case _key %}
|
81
102
|
{% when 'width' %}
|
@@ -84,68 +105,91 @@
|
|
84
105
|
{% assign _height = _value %}
|
85
106
|
{% when 'src' %}
|
86
107
|
{% assign _src = _value %}
|
108
|
+
{% when 'lqip' %}
|
109
|
+
{% assign _lqip = _value %}
|
110
|
+
{% when 'class' %}
|
111
|
+
{% assign _class = _value %}
|
87
112
|
{% endcase %}
|
88
113
|
|
89
|
-
{% if _width and _height and _src %}
|
90
|
-
{% break %}
|
91
|
-
{% endif %}
|
92
114
|
{% endfor %}
|
93
115
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
{% if site.img_cdn contains '//' %}
|
100
|
-
{% assign _src_prefix = site.img_cdn %}
|
101
|
-
{% else %}
|
102
|
-
{% assign _src_prefix = site.img_cdn | relative_url %}
|
103
|
-
{% endif %}
|
104
|
-
{% else %}
|
105
|
-
{% assign _src_prefix = site.baseurl %}
|
106
|
-
{% endif %}
|
107
|
-
|
108
|
-
<!-- Add image path -->
|
109
|
-
{% if page.img_path %}
|
110
|
-
{% assign _path = page.img_path %}
|
111
|
-
{% assign last_char = _path | slice: -1 %}
|
112
|
-
|
113
|
-
{% unless last_char == '/' %}
|
114
|
-
{% assign _path = _path | append: '/' %}
|
115
|
-
{% endunless %}
|
116
|
+
<!-- take out classes -->
|
117
|
+
{% if _class %}
|
118
|
+
{% capture _old_class %}class="{{ _class }}"{% endcapture %}
|
119
|
+
{% assign _left = _left | remove: _old_class %}
|
120
|
+
{% endif %}
|
116
121
|
|
117
|
-
|
118
|
-
{% endif %}
|
122
|
+
{% assign _final_src = nil %}
|
119
123
|
|
120
|
-
|
121
|
-
|
124
|
+
{% unless _src contains '//' %}
|
125
|
+
{% assign _final_src = _path_prefix | append: _src %}
|
126
|
+
{% capture _src_from %}"{{ _src }}"{% endcapture %}
|
127
|
+
{% capture _src_to %}"{{ _final_src }}"{% endcapture %}
|
128
|
+
{% assign _left = _left | replace: _src_from, _src_to %}
|
129
|
+
{% endunless %}
|
122
130
|
|
131
|
+
{% if _lqip %}
|
132
|
+
{% unless _lqip contains ':' %}
|
133
|
+
{% assign _final_lqip = _path_prefix | append: _lqip %}
|
134
|
+
{% capture _lqip_from %}"{{ _lqip }}"{% endcapture %}
|
135
|
+
{% capture _lqip_to %}"{{ _final_lqip }}"{% endcapture %}
|
136
|
+
{% assign _left = _left | replace: _lqip_from, _lqip_to %}
|
123
137
|
{% endunless %}
|
124
|
-
|
125
|
-
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
126
|
-
|
127
|
-
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
128
|
-
|
129
138
|
{% endif %}
|
130
139
|
|
131
|
-
<!--
|
132
|
-
|
133
|
-
{% if
|
134
|
-
{
|
135
|
-
|
136
|
-
{
|
140
|
+
<!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
|
141
|
+
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
142
|
+
{% if _left contains 'class=' %}
|
143
|
+
{% assign _left = _left | replace: 'class="', 'class="lazyload '%}
|
144
|
+
{% else %}
|
145
|
+
{% assign _left = _left | append: ' class="lazyload"' %}
|
146
|
+
{% endif %}
|
137
147
|
|
138
|
-
|
148
|
+
<!-- add image placeholder -->
|
149
|
+
{% if _lqip %}
|
150
|
+
{% assign _left = _left | replace: ' lqip=', ' data-lqip="true" src=' %}
|
151
|
+
{% else %}
|
152
|
+
{% if _width and _height %}
|
153
|
+
<!-- add SVG placehoder -->
|
154
|
+
{%- capture _svg -%}
|
155
|
+
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
156
|
+
{%- endcapture -%}
|
157
|
+
{% assign _left = _svg | append: ' ' | append: _left %}
|
158
|
+
{% assign _class = _class | append: ' shimmer' %}
|
159
|
+
{% endif %}
|
139
160
|
{% endif %}
|
140
161
|
|
141
162
|
<!-- Bypass the HTML-proofer test -->
|
142
163
|
{% assign _left = _left | append: ' data-proofer-ignore' %}
|
143
164
|
|
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 %}
|
177
|
+
<!-- create the image wrapper -->
|
178
|
+
{%- capture _wrapper_start -%}
|
179
|
+
<a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
|
180
|
+
{%- endcapture -%}
|
181
|
+
{% assign _img_content = _img_content | append: _wrapper_start %}
|
182
|
+
{% assign _right = _right | prepend: '></a' %}
|
183
|
+
{% endif %}
|
184
|
+
|
185
|
+
<!-- combine -->
|
144
186
|
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
|
145
187
|
|
146
188
|
{% endfor %}
|
147
189
|
|
148
|
-
{%
|
190
|
+
{% if _img_content %}
|
191
|
+
{% assign _content = _img_content %}
|
192
|
+
{% endif %}
|
149
193
|
|
150
194
|
{% endif %}
|
151
195
|
|
data/_includes/sidebar.html
CHANGED
@@ -81,7 +81,17 @@
|
|
81
81
|
|
82
82
|
{% if url %}
|
83
83
|
<a href="{{ url }}" aria-label="{{ entry.type }}"
|
84
|
-
{%
|
84
|
+
{% assign link_types = nil %}
|
85
|
+
{% unless entry.noblank %}
|
86
|
+
{% assign link_types = link_types | append: " noopener" %}
|
87
|
+
target="_blank"
|
88
|
+
{% endunless %}
|
89
|
+
|
90
|
+
{% if entry.type == 'mastodon' %}
|
91
|
+
{% assign link_types = link_types | append: " me" %}
|
92
|
+
{% endif %}
|
93
|
+
|
94
|
+
{% if link_types %}rel="{{ link_types | lstrip }}"{% endif %}>
|
85
95
|
<i class="{{ entry.icon }}"></i>
|
86
96
|
</a>
|
87
97
|
{% endif %}
|
data/_layouts/post.html
CHANGED
@@ -26,31 +26,22 @@ tail_includes:
|
|
26
26
|
</span>
|
27
27
|
{% endif %}
|
28
28
|
|
29
|
-
{% if page.image
|
30
|
-
{% capture
|
31
|
-
|
29
|
+
{% if page.image %}
|
30
|
+
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
|
31
|
+
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
|
32
|
+
{% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %}
|
33
|
+
|
34
|
+
{% capture lqip %}
|
35
|
+
{% if page.image.lqip %}
|
36
|
+
lqip="{{ page.image.lqip }}"
|
37
|
+
{% endif %}
|
32
38
|
{% endcapture %}
|
33
39
|
|
34
40
|
<div class="mt-3 mb-3">
|
35
|
-
<img src
|
36
|
-
|
37
|
-
|
38
|
-
{% if page.image.width %}
|
39
|
-
width="{{ page.image.width }}"
|
40
|
-
{% elsif page.image.w %}
|
41
|
-
width="{{ page.image.w }}"
|
42
|
-
{% endif %}
|
43
|
-
|
44
|
-
{% if page.image.height %}
|
45
|
-
height="{{ page.image.height }}"
|
46
|
-
{% elsif page.image.h %}
|
47
|
-
height="{{ page.image.h }}"
|
48
|
-
{% endif %}>
|
49
|
-
|
50
|
-
{% if page.image.alt %}
|
41
|
+
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip | strip }}>
|
42
|
+
{%- if page.image.alt -%}
|
51
43
|
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
|
52
|
-
{
|
53
|
-
|
44
|
+
{%- endif -%}
|
54
45
|
</div>
|
55
46
|
{% endif %}
|
56
47
|
|