Skip to content

Commit

Permalink
fix: adapt the giscus localization parameter (mmistakes#1810)
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 authored Jun 16, 2024
1 parent f1d3583 commit 0709854
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion _includes/comments/giscus.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
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 = {
src: 'https://giscus.app/client.js',
'data-repo': '{{ site.comments.giscus.repo}}',
Expand All @@ -29,7 +35,7 @@
'data-emit-metadata': '0',
'data-theme': initTheme,
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
'data-lang': '{{ site.comments.giscus.lang | default: lang }}',
'data-lang': lang,
'data-loading': 'lazy',
crossorigin: 'anonymous',
async: ''
Expand Down

0 comments on commit 0709854

Please sign in to comment.