jekyll-theme-chirpy 6.5.5 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -6
  3. data/_data/origin/basic.yml +3 -10
  4. data/_data/origin/cors.yml +17 -22
  5. data/_includes/analytics/cloudflare.html +7 -0
  6. data/_includes/analytics/goatcounter.html +6 -0
  7. data/_includes/analytics/google.html +13 -0
  8. data/_includes/analytics/matomo.html +14 -0
  9. data/_includes/analytics/umami.html +6 -0
  10. data/_includes/comments/disqus.html +5 -5
  11. data/_includes/comments/giscus.html +3 -3
  12. data/_includes/comments/utterances.html +4 -5
  13. data/_includes/comments.html +3 -3
  14. data/_includes/embed/audio.html +35 -0
  15. data/_includes/embed/bilibili.html +3 -4
  16. data/_includes/embed/video.html +59 -0
  17. data/_includes/embed/youtube.html +1 -1
  18. data/_includes/footer.html +8 -1
  19. data/_includes/head.html +21 -25
  20. data/_includes/js-selector.html +31 -37
  21. data/_includes/lang.html +3 -1
  22. data/_includes/{img-url.html → media-url.html} +8 -8
  23. data/_includes/mermaid.html +31 -27
  24. data/_includes/mode-toggle.html +24 -51
  25. data/_includes/pageviews/goatcounter.html +18 -0
  26. data/_includes/post-description.html +16 -0
  27. data/_includes/refactor-content.html +1 -1
  28. data/_includes/related-posts.html +2 -4
  29. data/_includes/search-loader.html +1 -1
  30. data/_includes/search-results.html +1 -1
  31. data/_includes/sidebar.html +2 -2
  32. data/_includes/toc.html +2 -2
  33. data/_includes/topbar.html +1 -1
  34. data/_layouts/compress.html +2 -2
  35. data/_layouts/default.html +3 -8
  36. data/_layouts/home.html +2 -5
  37. data/_layouts/post.html +17 -4
  38. data/_sass/addon/commons.scss +38 -46
  39. data/_sass/colors/typography-dark.scss +0 -4
  40. data/_sass/dist/bootstrap.css +5 -0
  41. data/_sass/layout/post.scss +23 -10
  42. data/_sass/main.bundle.scss +2 -0
  43. data/assets/css/jekyll-theme-chirpy.scss +5 -1
  44. data/assets/feed.xml +1 -8
  45. data/assets/js/data/mathjax.js +25 -0
  46. data/assets/js/data/swconf.js +0 -14
  47. data/assets/js/dist/app.min.js +4 -0
  48. data/assets/js/dist/categories.min.js +2 -2
  49. data/assets/js/dist/commons.min.js +2 -2
  50. data/assets/js/dist/home.min.js +2 -2
  51. data/assets/js/dist/misc.min.js +2 -2
  52. data/assets/js/dist/page.min.js +2 -2
  53. data/assets/js/dist/post.min.js +2 -2
  54. data/assets/js/dist/sw.min.js +5 -0
  55. metadata +22 -12
  56. data/_includes/goatcounter.html +0 -8
  57. data/_includes/google-analytics.html +0 -14
  58. data/assets/js/pwa/app.js +0 -54
  59. data/assets/js/pwa/sw.js +0 -101
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 484bcb958aef9beaef2b9e939fab2c1c8dc4cd9d0d59381c130aa289fe4575ba
4
- data.tar.gz: a86cc2b86d4e0bac2518c279a42846af6cb1148d1d4eeba8478b66cb81db4c44
3
+ metadata.gz: c91a2e4a3421daca3bc3ddcafff42054a07939ca040eb23d9ea50c809059e37b
4
+ data.tar.gz: 58c9f119e0304579bf48e3cd77dcd05cb7e40b56039af99292b391e66be84d63
5
5
  SHA512:
6
- metadata.gz: 84d0ec5cb94dc426c21dd27cbebfe9104b0f555a4833e8a8a6f48885b0b6a814c47d8d2d2651efa3fa635e8e5783975d2f6f4e0d11ae8c3558960f10f86eed40
7
- data.tar.gz: cb82df0c441231f7694fe07b7fd978b785604562fa5d7d9402fa287b19a0362db14c1f7f903e2fccb24c85daf47eb1e0804ac32d2460ad36fb25e1fd1ff5e923
6
+ metadata.gz: b88b2e40a885e6a0ca252093fff60262f2535ae431049de18e1b92b2b3822f54a42ffb1747fe5482c1a6da169d9ca38b46dc9b2a769724632dc6c51f68e55474
7
+ data.tar.gz: 46a3f94ee7f6d1858503bb4e4580fa27935781a39c68da9fdd80434678b13f7b8990892fbff485951465259a30a6fa92a2eb8945bb0fd2f80b44f66c5b9027cb
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
+ <!-- markdownlint-disable-next-line -->
1
2
  <div align="center">
2
3
 
4
+ <!-- markdownlint-disable-next-line -->
3
5
  # Chirpy Jekyll Theme
4
6
 
5
7
  A minimal, responsive, and feature-rich Jekyll theme for technical writing.
@@ -18,7 +20,7 @@
18
20
 
19
21
  ## Features
20
22
 
21
- - Dark / Light Theme Mode
23
+ - Dark Theme
22
24
  - Localized UI language
23
25
  - Pinned Posts on Home Page
24
26
  - Hierarchical Categories
@@ -28,13 +30,13 @@
28
30
  - Syntax Highlighting
29
31
  - Mathematical Expressions
30
32
  - Mermaid Diagrams & Flowcharts
31
- - Dark / Light Mode Images
32
- - Embed Videos
33
- - Disqus / Giscus / Utterances Comments
33
+ - Dark Mode Images
34
+ - Embed Media
35
+ - Comment Systems
34
36
  - Built-in Search
35
37
  - Atom Feeds
36
38
  - PWA
37
- - Google Analytics / GoatCounter
39
+ - Web Analytics
38
40
  - SEO & Performance Optimization
39
41
 
40
42
  ## Documentation
@@ -54,7 +56,7 @@ For details, see the "[Contributing Guidelines][contribute-guide]".
54
56
  Thanks to [all the contributors][contributors] involved in the development of the project!
55
57
 
56
58
  [![all-contributors](https://contrib.rocks/image?repo=cotes2020/jekyll-theme-chirpy&columns=16)][contributors]
57
- <sub> —— Made with [contrib.rocks](https://contrib.rocks)</sub>
59
+ <sub> Made with [contrib.rocks](https://contrib.rocks)</sub>
58
60
 
59
61
  ### Third-Party Assets
60
62
 
@@ -4,13 +4,6 @@ webfonts: /assets/lib/fonts/main.css
4
4
 
5
5
  # Libraries
6
6
 
7
- jquery:
8
- js: /assets/lib/jquery/jquery.min.js
9
-
10
- bootstrap:
11
- css: /assets/lib/bootstrap/bootstrap.min.css
12
- js: /assets/lib/bootstrap/bootstrap.bundle.min.js
13
-
14
7
  toc:
15
8
  css: /assets/lib/tocbot/tocbot.min.css
16
9
  js: /assets/lib/tocbot/tocbot.min.js
@@ -31,9 +24,9 @@ dayjs:
31
24
  relativeTime: /assets/lib/dayjs/plugin/relativeTime.min.js
32
25
  localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.min.js
33
26
 
34
- magnific-popup:
35
- css: /assets/lib/magnific-popup/magnific-popup.css
36
- js: /assets/lib/magnific-popup/jquery.magnific-popup.min.js
27
+ glightbox:
28
+ css: /assets/lib/glightbox/glightbox.min.css
29
+ js: /assets/lib/glightbox/glightbox.min.js
37
30
 
38
31
  lazy-polyfill:
39
32
  css: /assets/lib/loading-attribute-polyfill/loading-attribute-polyfill.min.css
@@ -1,29 +1,24 @@
1
- # CDNs
2
-
3
- cdns:
4
- # Google Fonts
1
+ # Resource Hints
2
+ resource_hints:
5
3
  - url: https://fonts.googleapis.com
4
+ links:
5
+ - rel: preconnect
6
+ - rel: dns-prefetch
6
7
  - url: https://fonts.gstatic.com
7
- args: crossorigin
8
- - url: https://fonts.googleapis.com
9
- # jsDelivr CDN
8
+ links:
9
+ - rel: preconnect
10
+ opts: [crossorigin]
11
+ - rel: dns-prefetch
10
12
  - url: https://cdn.jsdelivr.net
11
- # polyfill.io for math (cdnjs.cloudflare.com/polyfill)
12
- - url: https://cdnjs.cloudflare.com
13
-
14
- # fonts
13
+ links:
14
+ - rel: preconnect
15
+ - rel: dns-prefetch
15
16
 
16
- webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
17
+ # Web Fonts
18
+ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
17
19
 
18
20
  # Libraries
19
21
 
20
- jquery:
21
- js: https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
22
-
23
- bootstrap:
24
- css: https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css
25
- js: https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js
26
-
27
22
  toc:
28
23
  css: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.css
29
24
  js: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.js
@@ -44,9 +39,9 @@ dayjs:
44
39
  relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/plugin/relativeTime.min.js
45
40
  localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.10/plugin/localizedFormat.min.js
46
41
 
47
- magnific-popup:
48
- css: https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css
49
- js: https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/jquery.magnific-popup.min.js
42
+ glightbox:
43
+ css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css
44
+ js: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/js/glightbox.min.js
50
45
 
51
46
  lazy-polyfill:
52
47
  css: https://cdn.jsdelivr.net/npm/loading-attribute-polyfill@2.1.1/dist/loading-attribute-polyfill.min.css
@@ -0,0 +1,7 @@
1
+ <!-- Cloudflare Web Analytics -->
2
+ <script
3
+ defer
4
+ src="https://static.cloudflareinsights.com/beacon.min.js"
5
+ data-cf-beacon='{"token": "{{ site.analytics.cloudflare.id }}"}'
6
+ ></script>
7
+ <!-- End Cloudflare Web Analytics -->
@@ -0,0 +1,6 @@
1
+ <!-- GoatCounter -->
2
+ <script
3
+ async
4
+ src="https://gc.zgo.at/count.js"
5
+ data-goatcounter="https://{{ site.analytics.goatcounter.id }}.goatcounter.com/count"
6
+ ></script>
@@ -0,0 +1,13 @@
1
+ <!-- Global site tag (gtag.js) - Google Analytics -->
2
+ <script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.id }}"></script>
3
+ <script>
4
+ document.addEventListener('DOMContentLoaded', function (event) {
5
+ window.dataLayer = window.dataLayer || [];
6
+ function gtag() {
7
+ dataLayer.push(arguments);
8
+ }
9
+
10
+ gtag('js', new Date());
11
+ gtag('config', '{{ site.analytics.google.id }}');
12
+ });
13
+ </script>
@@ -0,0 +1,14 @@
1
+ <!-- Matomo -->
2
+ <script type="text/javascript">
3
+ var _paq = window._paq = window._paq || [];
4
+ _paq.push(['trackPageView']);
5
+ _paq.push(['enableLinkTracking']);
6
+ (function() {
7
+ var u="//{{ site.analytics.matomo.domain }}/";
8
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
9
+ _paq.push(['setSiteId', {{ site.analytics.matomo.id }}]);
10
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
11
+ g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
12
+ })();
13
+ </script>
14
+ <!-- End Matomo Code -->
@@ -0,0 +1,6 @@
1
+ <!-- Umami -->
2
+ <script
3
+ defer
4
+ src="{{ site.analytics.umami.domain }}/script.js"
5
+ data-website-id="{{ site.analytics.umami.id }}"
6
+ ></script>
@@ -10,7 +10,7 @@
10
10
  this.page.identifier = '{{ page.url }}';
11
11
  };
12
12
 
13
- /* Lazy loading */
13
+ {%- comment -%} Lazy loading {%- endcomment -%}
14
14
  var disqus_observer = new IntersectionObserver(
15
15
  function (entries) {
16
16
  if (entries[0].isIntersecting) {
@@ -28,12 +28,12 @@
28
28
  { threshold: [0] }
29
29
  );
30
30
 
31
- disqus_observer.observe(document.querySelector('#disqus_thread'));
31
+ disqus_observer.observe(document.getElementById('disqus_thread'));
32
32
 
33
- /* Auto switch theme */
33
+ {%- comment -%} Auto switch theme {%- endcomment -%}
34
34
  function reloadDisqus() {
35
35
  if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
36
- /* Disqus hasn't been loaded */
36
+ {%- comment -%} Disqus hasn't been loaded {%- endcomment -%}
37
37
  if (typeof DISQUS === 'undefined') {
38
38
  return;
39
39
  }
@@ -44,7 +44,7 @@
44
44
  }
45
45
  }
46
46
 
47
- if (document.querySelector('.mode-toggle')) {
47
+ if (document.getElementById('mode-toggle')) {
48
48
  window.addEventListener('message', reloadDisqus);
49
49
  }
50
50
  </script>
@@ -2,7 +2,6 @@
2
2
  <script type="text/javascript">
3
3
  (function () {
4
4
  const origin = 'https://giscus.app';
5
- const iframe = 'iframe.giscus-frame';
6
5
  const lightTheme = 'light';
7
6
  const darkTheme = 'dark_dimmed';
8
7
 
@@ -25,6 +24,7 @@
25
24
  'data-category': '{{ site.comments.giscus.category }}',
26
25
  'data-category-id': '{{ site.comments.giscus.category_id }}',
27
26
  'data-mapping': '{{ site.comments.giscus.mapping | default: 'pathname' }}',
27
+ 'data-strict' : '{{ site.comments.giscus.strict | default: '0' }}',
28
28
  'data-reactions-enabled': '{{ site.comments.giscus.reactions_enabled | default: '1' }}',
29
29
  'data-emit-metadata': '0',
30
30
  'data-theme': initTheme,
@@ -47,7 +47,7 @@
47
47
  event.data &&
48
48
  event.data.direction === ModeToggle.ID
49
49
  ) {
50
- /* global theme mode changed */
50
+ {%- comment -%} global theme mode changed {%- endcomment -%}
51
51
  const mode = event.data.message;
52
52
  const theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
53
53
 
@@ -57,7 +57,7 @@
57
57
  }
58
58
  };
59
59
 
60
- const giscus = document.querySelector(iframe).contentWindow;
60
+ const giscus = document.getElementsByClassName('giscus-frame')[0].contentWindow;
61
61
  giscus.postMessage({ giscus: message }, origin);
62
62
  }
63
63
  });
@@ -10,7 +10,6 @@
10
10
  <script type="text/javascript">
11
11
  (function () {
12
12
  const origin = 'https://utteranc.es';
13
- const iframe = 'iframe.utterances-frame';
14
13
  const lightTheme = 'github-light';
15
14
  const darkTheme = 'github-dark';
16
15
  let initTheme = lightTheme;
@@ -26,12 +25,12 @@
26
25
  addEventListener('message', (event) => {
27
26
  let theme;
28
27
 
29
- /* credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> */
28
+ {%- comment -%} credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> {%- endcomment -%}
30
29
  if (event.origin === origin) {
31
- /* page initial */
30
+ {%- comment -%} page initial {%- endcomment -%}
32
31
  theme = initTheme;
33
32
  } else if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
34
- /* global theme mode changed */
33
+ {%- comment -%} global theme mode changed {%- endcomment -%}
35
34
  const mode = event.data.message;
36
35
  theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
37
36
  } else {
@@ -43,7 +42,7 @@
43
42
  theme: theme
44
43
  };
45
44
 
46
- const utterances = document.querySelector(iframe).contentWindow;
45
+ const utterances = document.getElementsByClassName('utterances-frame')[0].contentWindow;
47
46
  utterances.postMessage(message, origin);
48
47
  });
49
48
  })();
@@ -1,5 +1,5 @@
1
- <!-- The comments switcher -->
2
- {% if page.comments and site.comments.active %}
3
- {% capture path %}comments/{{ site.comments.active }}.html{% endcapture %}
1
+ <!-- The comments switcher -->
2
+ {% if page.comments and site.comments.provider %}
3
+ {% capture path %}comments/{{ site.comments.provider }}.html{% endcapture %}
4
4
  {% include {{ path }} %}
5
5
  {% endif %}
@@ -0,0 +1,35 @@
1
+ {% assign src = include.src | strip %}
2
+ {% assign title = include.title | strip %}
3
+ {% assign types = include.types | default: '' | strip | split: '|' %}
4
+
5
+ {% unless src contains '://' %}
6
+ {%- capture src -%}
7
+ {% include media-url.html src=src %}
8
+ {%- endcapture -%}
9
+ {% endunless %}
10
+
11
+ <p>
12
+ <audio class="embed-audio" controls>
13
+ {% assign extension = src | split: '.' | last %}
14
+ {% assign types = extension | concat: types %}
15
+
16
+ {% assign ext_size = extension | size %}
17
+ {% assign src_size = src | size %}
18
+ {% assign slice_size = src_size | minus: ext_size %}
19
+
20
+ {% assign filepath = src | slice: 0, slice_size %}
21
+
22
+ {% for type in types %}
23
+ {% assign src = filepath | append: type %}
24
+ {% assign media_item = site.data.media | find: 'extension', type %}
25
+ {% assign mime_type = media_item.mime_type | default: type %}
26
+ <source src="{{ src }}" type="audio/{{ mime_type }}">
27
+ {% endfor %}
28
+
29
+ Your browser does not support the audio tag. Here is a
30
+ <a href="{{ src | strip }}">link to the audio file</a> instead.
31
+ </audio>
32
+ {% if title %}
33
+ <em>{{ title }}</em>
34
+ {% endif %}
35
+ </p>
@@ -1,10 +1,9 @@
1
1
  <iframe
2
- class="embed-video bilibili"
2
+ class="embed-video"
3
3
  loading="lazy"
4
4
  src="https://player.bilibili.com/player.html?bvid={{ include.id }}"
5
5
  scrolling="no"
6
- border="0"
7
- frameborder="no"
6
+ frameborder="0"
8
7
  framespacing="0"
9
8
  allowfullscreen="true"
10
- ></iframe>
9
+ ></iframe>
@@ -0,0 +1,59 @@
1
+ {% assign video_url = include.src %}
2
+ {% assign title = include.title %}
3
+ {% assign poster_url = include.poster %}
4
+ {% assign types = include.types | default: '' | strip | split: '|' %}
5
+
6
+ {% unless video_url contains '://' %}
7
+ {%- capture video_url -%}
8
+ {% include media-url.html src=video_url %}
9
+ {%- endcapture -%}
10
+ {% endunless %}
11
+
12
+ {% if poster_url %}
13
+ {% unless poster_url contains '://' %}
14
+ {%- capture poster_url -%}
15
+ {% include media-url.html src=poster_url subpath=page.media_subpath %}
16
+ {%- endcapture -%}
17
+ {% endunless %}
18
+ {% assign poster = 'poster="' | append: poster_url | append: '"' %}
19
+ {% endif %}
20
+
21
+ {% assign attributes = 'controls' %}
22
+
23
+ {% if include.autoplay %}
24
+ {% assign attributes = attributes | append: ' ' | append: 'autoplay' %}
25
+ {% endif %}
26
+
27
+ {% if include.loop %}
28
+ {% assign attributes = attributes | append: ' ' | append: 'loop' %}
29
+ {% endif %}
30
+
31
+ {% if include.muted %}
32
+ {% assign attributes = attributes | append: ' ' | append: 'muted' %}
33
+ {% endif %}
34
+
35
+ <p>
36
+ <video class="embed-video file" {{ poster }} {{ attributes }}>
37
+ {% assign extension = video_url | split: '.' | last %}
38
+ {% assign types = extension | concat: types %}
39
+
40
+ {% assign ext_size = extension | size %}
41
+ {% assign src_size = video_url | size %}
42
+ {% assign slice_size = src_size | minus: ext_size %}
43
+
44
+ {% assign filepath = video_url | slice: 0, slice_size %}
45
+
46
+ {% for type in types %}
47
+ {% assign src = filepath | append: type %}
48
+ {% assign media_item = site.data.media | find: 'extension', type %}
49
+ {% assign mime_type = media_item.mime_type | default: type %}
50
+ <source src="{{ src }}" type="video/{{ mime_type }}">
51
+ {% endfor %}
52
+
53
+ Your browser does not support the video tag. Here is a
54
+ <a href="{{ video_url | strip }}">link to the video file</a> instead.
55
+ </video>
56
+ {% if title %}
57
+ <em>{{ title }}</em>
58
+ {% endif %}
59
+ </p>
@@ -1,5 +1,5 @@
1
1
  <iframe
2
- class="embed-video youtube"
2
+ class="embed-video"
3
3
  loading="lazy"
4
4
  src="https://www.youtube.com/embed/{{ include.id }}"
5
5
  title="YouTube video player"
@@ -34,7 +34,14 @@
34
34
  {%- endcapture -%}
35
35
 
36
36
  {%- capture _theme -%}
37
- <a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
37
+ <a
38
+ data-bs-toggle="tooltip"
39
+ data-bs-placement="top"
40
+ title="v{{ theme.version }}"
41
+ href="https://github.com/cotes2020/jekyll-theme-chirpy"
42
+ target="_blank"
43
+ rel="noopener"
44
+ >Chirpy</a>
38
45
  {%- endcapture -%}
39
46
 
40
47
  {{ site.data.locales[include.lang].meta | replace: ':PLATFORM', _platform | replace: ':THEME', _theme }}
data/_includes/head.html CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  {% unless src contains '://' %}
22
22
  {%- capture img_url -%}
23
- {% include img-url.html src=src img_path=page.img_path absolute=true %}
23
+ {% include media-url.html src=src subpath=page.media_subpath absolute=true %}
24
24
  {%- endcapture -%}
25
25
 
26
26
  {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
@@ -31,7 +31,7 @@
31
31
 
32
32
  {% elsif site.social_preview_image %}
33
33
  {%- capture img_url -%}
34
- {% include img-url.html src=site.social_preview_image absolute=true %}
34
+ {% include media-url.html src=site.social_preview_image absolute=true %}
35
35
  {%- endcapture -%}
36
36
 
37
37
  {%- capture og_image -%}
@@ -59,34 +59,30 @@
59
59
 
60
60
  {% include_cached favicons.html %}
61
61
 
62
- {% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %}
63
- <link href="{{ site.data.origin[type].webfonts | relative_url }}" rel="stylesheet">
64
-
65
- {% else %}
66
- {% for cdn in site.data.origin[type].cdns %}
67
- <link rel="preconnect" href="{{ cdn.url }}" {{ cdn.args }}>
68
- <link rel="dns-prefetch" href="{{ cdn.url }}" {{ cdn.args }}>
62
+ <!-- Resource Hints -->
63
+ {% unless site.assets.self_host.enabled %}
64
+ {% for hint in site.data.origin.cors.resource_hints %}
65
+ {% for link in hint.links %}
66
+ <link rel="{{ link.rel }}" href="{{ hint.url }}" {{ link.opts | join: ' ' }}>
67
+ {% endfor %}
69
68
  {% endfor %}
69
+ {% endunless %}
70
70
 
71
- <link rel="stylesheet" href="{{ site.data.origin[type].webfonts | relative_url }}">
72
- {% endif %}
73
-
74
- <!-- GA -->
75
- {% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
76
- <link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
77
- <link rel="dns-prefetch" href="https://www.google-analytics.com">
71
+ <!-- Bootstrap -->
72
+ {% unless jekyll.environment == 'production' %}
73
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
74
+ {% endunless %}
78
75
 
79
- <link rel="preconnect" href="https://www.googletagmanager.com" crossorigin="anonymous">
80
- <link rel="dns-prefetch" href="https://www.googletagmanager.com">
81
- {% endif %}
76
+ <!-- Theme style -->
77
+ <link rel="stylesheet" href="{{ '/assets/css/:THEME.css' | replace: ':THEME', site.theme | relative_url }}">
82
78
 
83
- <!-- Bootstrap -->
84
- <link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url }}">
79
+ <!-- Web Font -->
80
+ <link rel="stylesheet" href="{{ site.data.origin[type].webfonts | relative_url }}">
85
81
 
86
- <!-- Font Awesome -->
82
+ <!-- Font Awesome Icons -->
87
83
  <link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">
88
84
 
89
- <link rel="stylesheet" href="{{ '/assets/css/:THEME.css' | replace: ':THEME', site.theme | relative_url }}">
85
+ <!-- 3rd-party Dependencies -->
90
86
 
91
87
  {% if site.toc and page.toc %}
92
88
  <link rel="stylesheet" href="{{ site.data.origin[type].toc.css | relative_url }}">
@@ -97,8 +93,8 @@
97
93
  {% endif %}
98
94
 
99
95
  {% if page.layout == 'page' or page.layout == 'post' %}
100
- <!-- Manific Popup -->
101
- <link rel="stylesheet" href="{{ site.data.origin[type].magnific-popup.css | relative_url }}">
96
+ <!-- Image Popup -->
97
+ <link rel="stylesheet" href="{{ site.data.origin[type].glightbox.css | relative_url }}">
102
98
  {% endif %}
103
99
 
104
100
  <!-- JavaScript -->
@@ -2,12 +2,7 @@
2
2
 
3
3
  <!-- commons -->
4
4
 
5
- {% assign urls = site.data.origin[type].jquery.js
6
- | append: ','
7
- | append: site.data.origin[type].bootstrap.js
8
- | append: ','
9
- | append: site.data.origin[type].search.js
10
- %}
5
+ {% assign urls = site.data.origin[type].search.js %}
11
6
 
12
7
  <!-- layout specified -->
13
8
 
@@ -20,7 +15,7 @@
20
15
  <!-- image lazy-loading & popup & clipboard -->
21
16
  {% assign urls = urls
22
17
  | append: ','
23
- | append: site.data.origin[type]['magnific-popup'].js
18
+ | append: site.data.origin[type].glightbox.js
24
19
  | append: ','
25
20
  | append: site.data.origin[type].clipboard.js
26
21
  %}
@@ -33,7 +28,7 @@
33
28
  or page.layout == 'category'
34
29
  or page.layout == 'tag'
35
30
  %}
36
- {% assign locale = site.lang | split: '-' | first %}
31
+ {% assign locale = include.lang | split: '-' | first %}
37
32
 
38
33
  {% assign urls = urls
39
34
  | append: ','
@@ -68,46 +63,45 @@
68
63
  {% endcase %}
69
64
 
70
65
  {% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %}
71
- <script defer src="{{ script | relative_url }}"></script>
66
+ <script src="{{ script | relative_url }}"></script>
72
67
 
73
68
  {% if page.math %}
74
69
  <!-- MathJax -->
75
- <script>
76
- /* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
77
- MathJax = {
78
- tex: {
79
- /* start/end delimiter pairs for in-line math */
80
- inlineMath: [
81
- ['$', '$'],
82
- ['\\(', '\\)']
83
- ],
84
- /* start/end delimiter pairs for display math */
85
- displayMath: [
86
- ['$$', '$$'],
87
- ['\\[', '\\]']
88
- ],
89
- /* equation numbering */
90
- tags: 'ams'
91
- }
92
- };
93
- </script>
70
+ <script src="{{ '/assets/js/data/mathjax.js' | relative_url }}"></script>
94
71
  <script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
95
72
  <script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
96
73
  {% endif %}
97
74
 
75
+ <!-- Pageviews -->
76
+ {% if page.layout == 'post' %}
77
+ {% assign provider = site.pageviews.provider %}
78
+
79
+ {% if provider and provider != empty %}
80
+ {% case provider %}
81
+ {% when 'goatcounter' %}
82
+ {% if site.analytics[provider].id != empty and site.analytics[provider].id %}
83
+ {% include pageviews/{{ provider }}.html %}
84
+ {% endif %}
85
+ {% endcase %}
86
+ {% endif %}
87
+ {% endif %}
88
+
89
+ {% if page.mermaid %}
90
+ {% include mermaid.html %}
91
+ {% endif %}
92
+
98
93
  {% if jekyll.environment == 'production' %}
99
94
  <!-- PWA -->
100
95
  {% if site.pwa.enabled %}
101
96
  <script defer src="{{ 'app.min.js' | prepend: js_dist | relative_url }}"></script>
102
97
  {% endif %}
103
98
 
104
- <!-- GA -->
105
- {% if site.google_analytics.id != empty and site.google_analytics.id %}
106
- {% include google-analytics.html %}
107
- {% endif %}
108
-
109
- <!-- GoatCounter -->
110
- {% if site.goatcounter.id != empty and site.goatcounter.id %}
111
- {% include goatcounter.html %}
112
- {% endif %}
99
+ <!-- Web Analytics -->
100
+ {% for analytics in site.analytics %}
101
+ {% capture str %}{{ analytics }}{% endcapture %}
102
+ {% assign type = str | split: '{' | first %}
103
+ {% if site.analytics[type].id and site.analytics[type].id != empty %}
104
+ {% include analytics/{{ type }}.html %}
105
+ {% endif %}
106
+ {% endfor %}
113
107
  {% endif %}
data/_includes/lang.html CHANGED
@@ -1,7 +1,9 @@
1
1
  {% comment %}
2
2
  Detect appearance language and return it through variable "lang"
3
3
  {% endcomment %}
4
- {% if site.data.locales[site.lang] %}
4
+ {% if site.data.locales[page.lang] %}
5
+ {% assign lang = page.lang %}
6
+ {% elsif site.data.locales[site.lang] %}
5
7
  {% assign lang = site.lang %}
6
8
  {% else %}
7
9
  {% assign lang = 'en' %}