mirror of
https://github.com/imfing/hextra.git
synced 2025-06-20 10:01:20 -04:00
fix: giscus theme and language display issues (#95)
* chore: minor update giscus template * fix: theme toggle should select all * chore: example configs for giscus * fix: language code in giscus
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{{- with site.Params.comment.giscus -}}
|
||||
{{- $lang := site.Language.LanguageCode | default `en` -}}
|
||||
|
||||
{{- $lang = site.Language.Lang | default `en` -}}
|
||||
{{- with site.Params.comment.giscus -}}
|
||||
<script>
|
||||
/*
|
||||
* "preferred color scheme" theme in giscus works using "prefers-color-scheme" in media query.
|
||||
@ -40,9 +40,6 @@
|
||||
"data-theme": getGiscusTheme(),
|
||||
"data-lang": "{{ .lang | default $lang }}",
|
||||
"crossorigin": "anonymous",
|
||||
{{ if .lazyLoading -}}
|
||||
"data-loading": "lazy",
|
||||
{{ end -}}
|
||||
"async": "",
|
||||
};
|
||||
|
||||
@ -52,11 +49,12 @@
|
||||
document.getElementById('giscus').appendChild(giscusScript);
|
||||
|
||||
// Update giscus theme when theme switcher is clicked
|
||||
const toggle = document.querySelector('.theme-toggle');
|
||||
if (toggle) {
|
||||
toggle.addEventListener('click', setGiscusTheme);
|
||||
const toggles = document.querySelectorAll(".theme-toggle");
|
||||
if (toggles) {
|
||||
toggles.forEach(toggle => toggle.addEventListener('click', setGiscusTheme));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="giscus"></div>
|
||||
{{- end -}}
|
||||
|
Reference in New Issue
Block a user