fix: adapt the giscus localization parameter (#1810)
This commit is contained in:
parent
f1d35832f4
commit
0709854dc8
1 changed files with 7 additions and 1 deletions
|
@ -17,6 +17,12 @@
|
||||||
initTheme = darkTheme;
|
initTheme = darkTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let lang = '{{ site.comments.giscus.lang | default: lang }}';
|
||||||
|
{%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%}
|
||||||
|
if (lang.length > 2 && !lang.startsWith('zh')) {
|
||||||
|
lang = lang.slice(0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
let giscusAttributes = {
|
let giscusAttributes = {
|
||||||
src: 'https://giscus.app/client.js',
|
src: 'https://giscus.app/client.js',
|
||||||
'data-repo': '{{ site.comments.giscus.repo}}',
|
'data-repo': '{{ site.comments.giscus.repo}}',
|
||||||
|
@ -29,7 +35,7 @@
|
||||||
'data-emit-metadata': '0',
|
'data-emit-metadata': '0',
|
||||||
'data-theme': initTheme,
|
'data-theme': initTheme,
|
||||||
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
|
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
|
||||||
'data-lang': '{{ site.comments.giscus.lang | default: lang }}',
|
'data-lang': lang,
|
||||||
'data-loading': 'lazy',
|
'data-loading': 'lazy',
|
||||||
crossorigin: 'anonymous',
|
crossorigin: 'anonymous',
|
||||||
async: ''
|
async: ''
|
||||||
|
|
Loading…
Reference in a new issue