Skip to content

Commit d3138c1

Browse files
committed
fix: update giscus theme handling and improve comments
1 parent 7237d80 commit d3138c1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

_includes/comments/giscus.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
<!-- Custom giscus embed (light theme forced) based on Chirpy default -->
1+
<!-- https://giscus.app/ -->
22
<script>
33
(function () {
4-
// Force light theme for giscus regardless of site theme
5-
const themeMapper = Theme.getThemeMapper('light', 'light');
4+
const themeMapper = Theme.getThemeMapper('light', 'dark_dimmed');
65
const initTheme = themeMapper[Theme.visualState];
76

87
let lang = '{{ site.comments.giscus.lang | default: lang }}';
8+
{% comment %} https://github.com/giscus/giscus/tree/main/locales {% endcomment %}
99
if (lang.length > 2 && !lang.startsWith('zh')) {
1010
lang = lang.slice(0, 2);
1111
}
1212

13-
const giscusAttributes = {
13+
let giscusAttributes = {
1414
src: 'https://giscus.app/client.js',
1515
'data-repo': '{{ site.comments.giscus.repo}}',
1616
'data-repo-id': '{{ site.comments.giscus.repo_id }}',
@@ -28,7 +28,7 @@
2828
async: ''
2929
};
3030

31-
const giscusNode = document.createElement('script');
31+
let giscusNode = document.createElement('script');
3232
Object.entries(giscusAttributes).forEach(([key, value]) =>
3333
giscusNode.setAttribute(key, value)
3434
);

0 commit comments

Comments
 (0)