Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0709854

Browse files
authoredJun 16, 2024
fix: adapt the giscus localization parameter (mmistakes#1810)
1 parent f1d3583 commit 0709854

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎_includes/comments/giscus.html

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
initTheme = darkTheme;
1818
}
1919

20+
let lang = '{{ site.comments.giscus.lang | default: lang }}';
21+
{%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%}
22+
if (lang.length > 2 && !lang.startsWith('zh')) {
23+
lang = lang.slice(0, 2);
24+
}
25+
2026
let giscusAttributes = {
2127
src: 'https://giscus.app/client.js',
2228
'data-repo': '{{ site.comments.giscus.repo}}',
@@ -29,7 +35,7 @@
2935
'data-emit-metadata': '0',
3036
'data-theme': initTheme,
3137
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
32-
'data-lang': '{{ site.comments.giscus.lang | default: lang }}',
38+
'data-lang': lang,
3339
'data-loading': 'lazy',
3440
crossorigin: 'anonymous',
3541
async: ''

0 commit comments

Comments
 (0)
Please sign in to comment.