Skip to content

Commit 5b5a386

Browse files
committed
Merge branch 'master' into production
2 parents c0e3e61 + fe2a3cd commit 5b5a386

27 files changed

+108
-81
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5-
### [5.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.0...v5.3.1) (2022-10-25)
5+
## [5.3.2](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.1...v5.3.2) (2022-11-22)
6+
7+
8+
### Bug Fixes
9+
10+
* `mermaid` occasionally fails to initialize ([#536](https://github.com/cotes2020/jekyll-theme-chirpy/issues/536)) ([48f14e3](https://github.com/cotes2020/jekyll-theme-chirpy/commit/48f14e39ac81bbfb3b9913ea3ee789d775b2d1ae))
11+
* **comment:** disqus doesn't follow theme mode switching ([b0d5956](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b0d5956f5a0ed894984d6b1754efeba04d8bc966))
12+
* restore full-text search ([#741](https://github.com/cotes2020/jekyll-theme-chirpy/issues/741)) ([6774e0e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6774e0e1fb37cf467b14be481347412713763f05))
13+
* the image URL in the SEO-related tags is incomplete ([#754](https://github.com/cotes2020/jekyll-theme-chirpy/issues/754)) ([f6e9a3f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f6e9a3fccf7ab34db71f8aefaf86fdcc05861076))
14+
15+
## [5.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.0...v5.3.1) (2022-10-25)
616

717

818
### Bug Fixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chi
102102
<!-- ReadMe links -->
103103

104104
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
105-
[cn-donation]: https://cotes2020.github.io/sponsor/
105+
[cn-donation]: https://sponsor.cotes.page/

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ theme_mode: # [light|dark]
7878
# will be added to all image (site avatar & posts' images) paths starting with '/'
7979
#
8080
# e.g. 'https://cdn.com'
81-
img_cdn: 'https://raw.githubusercontent.com/cotes2020/chirpy-images/main'
81+
img_cdn: 'https://demo-img.cotes.page'
8282

8383
# the avatar on sidebar, support local or CORS resources
8484
avatar: '/commons/avatar.jpg'

_data/assets/cross_origin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bootstrap-toc:
2727
js: https://cdn.jsdelivr.net/gh/afeld/[email protected]/dist/bootstrap-toc.min.js
2828

2929
fontawesome:
30-
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css
30+
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css
3131

3232
search:
3333
js: https://cdn.jsdelivr.net/npm/[email protected]/dest/simple-jekyll-search.min.js

_data/assets/self_host.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bootstrap-toc:
1616
js: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js
1717

1818
fontawesome:
19-
css: /assets/lib/fontawesome-free-5.15.4/css/all.min.css
19+
css: /assets/lib/fontawesome-free-6.2.1/css/all.min.css
2020

2121
search:
2222
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js

_includes/comments/disqus.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
};
1616

1717
/* Lazy loading */
18-
1918
var disqus_observer = new IntersectionObserver(function (entries) {
2019
if(entries[0].isIntersecting) {
2120
(function () {
@@ -32,23 +31,24 @@
3231
disqus_observer.observe(document.querySelector('#disqus_thread'));
3332

3433
/* Auto switch theme */
35-
3634
function reloadDisqus() {
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 });
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+
}
4445
}
4546
}
4647

4748
const modeToggle = document.querySelector(".mode-toggle");
4849

4950
if (typeof modeToggle !== "undefined") {
50-
/* modeToggle.addEventListener('click', reloadDisqus); // not pretty for 'color-scheme' */
51-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
51+
window.addEventListener("message", reloadDisqus);
5252
}
5353

5454
</script>

_includes/head.html

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,22 @@
2222
{% seo title=false %}
2323
{% endcapture %}
2424

25-
{% if site.img_cdn and seo_tags contains 'og:image' %}
26-
{% assign properties = 'og:image,twitter:image' | split: ',' %}
27-
28-
{% for prop in properties %}
29-
{% if site.img_cdn contains '//' %}
30-
<!-- `site.img_cdn` is a cross-origin URL -->
31-
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{% endcapture %}
32-
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{% endcapture %}
33-
{% else %}
34-
<!-- `site.img_cdn` is a local file path -->
35-
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{{ site.baseurl }}{% endcapture %}
36-
{% assign replacement = target | append: site.img_cdn %}
37-
{% endif %}
38-
39-
{% assign seo_tags = seo_tags | replace: target, replacement %}
25+
{% if page.image %}
26+
{% assign img = page.image.path | default: page.image %}
27+
{% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
28+
{% capture target %}"{{ img | absolute_url }}"{% endcapture %}
29+
30+
{% if site.img_cdn contains '//' %}
31+
<!-- it's a cross-origin URL -->
32+
{% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
33+
{% else %}
34+
<!-- it's a local file path -->
35+
{%- capture replacement -%}
36+
"{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
37+
{%- endcapture -%}
38+
{% endif %}
4039

41-
{% endfor %}
40+
{% assign seo_tags = seo_tags | replace: target, replacement %}
4241
{% endif %}
4342

4443
{{ seo_tags }}

_includes/mermaid.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
<script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script>
66

77
<script>
8-
$(function() {
8+
(function () {
9+
910
function updateMermaid(event) {
1011
if (event.source === window && event.data &&
11-
event.data.direction === ModeToggle.ID) {
12+
event.data.direction === ModeToggle.ID) {
1213

1314
const mode = event.data.message;
1415

1516
if (typeof mermaid === "undefined") {
1617
return;
1718
}
1819

19-
let expectedTheme = (mode === ModeToggle.DARK_MODE? "dark" : "default");
20-
let config = { theme: expectedTheme };
20+
let expectedTheme = (mode === ModeToggle.DARK_MODE ? "dark" : "default");
21+
let config = {theme: expectedTheme};
2122

2223
/* Re-render the SVG › <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
23-
$(".mermaid").each(function() {
24+
$(".mermaid").each(function () {
2425
let svgCode = $(this).prev().children().html();
2526
$(this).removeAttr("data-processed");
2627
$(this).html(svgCode);
@@ -35,23 +36,24 @@
3536

3637
if ($("html[data-mode=dark]").length > 0
3738
|| ($("html[data-mode]").length == 0
38-
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) {
39+
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
3940
initTheme = "dark";
4041
}
4142

4243
let mermaidConf = {
4344
theme: initTheme /* <default|dark|forest|neutral> */
4445
};
4546

46-
/* Markdown converts to HTML */
47-
$("pre").has("code.language-mermaid").each(function() {
47+
/* Create mermaid tag */
48+
$("pre").has("code.language-mermaid").each(function () {
4849
let svgCode = $(this).children().html();
4950
$(this).addClass("unloaded");
50-
$(this).after(`<div class=\"mermaid\">${svgCode}</div>`);
51+
$(this).after(`<pre class=\"mermaid\">${svgCode}</pre>`);
5152
});
5253

5354
mermaid.initialize(mermaidConf);
5455

5556
window.addEventListener("message", updateMermaid);
56-
});
57+
})();
58+
5759
</script>

_includes/refactor-content.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,7 @@
107107

108108
<!-- Add image path -->
109109
{% 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-
110+
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
117111
{% assign _src_prefix = _src_prefix | append: _path %}
118112
{% endif %}
119113

_javascript/copyright

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
2+
* Chirpy v5.3.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
33
* © 2019 Cotes Chung
44
* MIT Licensed
55
*/

0 commit comments

Comments
 (0)