Compare commits

...

5 Commits

Author SHA1 Message Date
Robb Shecter
9369f75213
Merge 27a70e4c122e0590248f0cb49767403f422d56a9 into 7b7eb0f1f32c401d5f76337b32af4996cfc67d94 2024-10-30 00:23:37 +03:00
Xin
7b7eb0f1f3
fix: add back empty content filter in search-data.json (#482)
Some checks failed
Deploy Hugo site to Pages / build (push) Has been cancelled
Deploy Hugo site to Pages / deploy (push) Has been cancelled
2024-10-21 22:22:56 +01:00
Robb Shecter
27a70e4c12
Cleanup 2024-04-15 18:53:50 -06:00
Robb Shecter
aeb0cad979
Special case for Chinese 2024-04-15 18:53:10 -06:00
Robb Shecter
fd38dd116f
Update giscus.html 2024-04-15 15:40:30 -06:00
2 changed files with 25 additions and 2 deletions

View File

@ -7,6 +7,7 @@
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.excludeSearch" "!=" true -}}
{{- $pages = where $pages "Content" "!=" "" -}}
{{- $output := dict -}}

View File

@ -1,4 +1,26 @@
{{- $lang := site.Language.LanguageCode | default `en` -}}
{{ $default_chinese := "zh-CN" }}
{{ $sl := site.Language }}
{{ $giscus_lang := $sl.Lang | default `en` }}
{{/*
Special case for Chinese.
Giscus uses the geophraphical language code for these.
See: https://github.com/giscus/giscus/tree/main/locales
*/}}
{{ if eq $giscus_lang "zh" }}
{{/* Create a code formatted for Giscus: zh-CN or zn-TW. */}}
{{ $code := lower $sl.LanguageCode }}
{{ if (hasSuffix $code "-cn") }}
{{ $giscus_lang = "zh-CN" }}
{{ else if (hasSuffix $code "-tw") }}
{{ $giscus_lang = "zh-TW" }}
{{ else }}
{{ $giscus_lang = $default_chinese }}
{{ end }}
{{ end }}
{{- with site.Params.comments.giscus -}}
<script>
@ -38,7 +60,7 @@
"data-emit-metadata": "{{ (string .emitMetadata) | default 0 }}",
"data-input-position": "{{ .inputPosition | default `top` }}",
"data-theme": getGiscusTheme(),
"data-lang": "{{ .lang | default $lang }}",
"data-lang": "{{ .lang | default $giscus_lang }}",
"crossorigin": "anonymous",
"async": "",
};