Merge branch 'master' into canary

This commit is contained in:
Jimmy Cai 2024-10-19 21:38:02 +00:00
commit 4b2bfc9c2e
5 changed files with 22 additions and 3 deletions

View file

@ -8,6 +8,10 @@ class StackColorScheme {
constructor(toggleEl: HTMLElement) { constructor(toggleEl: HTMLElement) {
this.bindMatchMedia(); this.bindMatchMedia();
this.currentScheme = this.getSavedScheme(); this.currentScheme = this.getSavedScheme();
if (window.matchMedia('(prefers-color-scheme: dark)').matches === true)
this.systemPreferScheme = 'dark'
else
this.systemPreferScheme = 'light';
this.dispatchEvent(document.documentElement.dataset.scheme as colorScheme); this.dispatchEvent(document.documentElement.dataset.scheme as colorScheme);

View file

@ -3,12 +3,20 @@ en:
languageName: English languageName: English
title: Hugo Theme Stack Example Site title: Hugo Theme Stack Example Site
weight: 1 weight: 1
params:
sidebar:
subtitle: Example description
zh-cn: zh-cn:
languageName: 中文 languageName: 中文
title: Hugo 主题 Stack 演示站点 title: Hugo 主题 Stack 演示站点
weight: 2 weight: 2
params:
sidebar:
subtitle: 演示说明
ar: ar:
languageName: عربي languageName: عربي
languagedirection: rtl languagedirection: rtl
title: موقع تجريبي title: موقع تجريبي
weight: 3 weight: 3
sidebar:
subtitle: وصف تجريبي

View file

@ -29,6 +29,12 @@ widget:
title: Archives title: Archives
more: Autres more: Autres
tagCloud:
title: Mots clés
categoriesCloud:
title: Catégories
search: search:
title: Rechercher title: Rechercher
placeholder: Cherchez un article, une publication, etc. placeholder: Cherchez un article, une publication, etc.

View file

@ -11,7 +11,8 @@
data-emit-metadata="{{- default 0 .emitMetadata -}}" data-emit-metadata="{{- default 0 .emitMetadata -}}"
data-input-position="{{- default `top` .inputPosition -}}" data-input-position="{{- default `top` .inputPosition -}}"
data-theme="{{- default `light` .lightTheme -}}" data-theme="{{- default `light` .lightTheme -}}"
data-lang="{{- default `en` .lang -}}" data-lang="{{- default $.Language.LanguageCode .lang -}}"
data-loading="{{- .loading -}}"
crossorigin="anonymous" crossorigin="anonymous"
async async
></script> ></script>

View file

@ -1,10 +1,10 @@
{{- $opts := dict "minify" hugo.IsProduction -}} {{- $opts := dict "minify" hugo.IsProduction -}}
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}} {{- $script := resources.Get "ts/main.ts" | js.Build $opts | fingerprint -}}
<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script> <script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script>
{{- with resources.Get "ts/custom.ts" -}} {{- with resources.Get "ts/custom.ts" -}}
{{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}} {{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}}
{{- $customScript := . | js.Build $opts -}} {{- $customScript := . | js.Build $opts | fingerprint -}}
<script type="text/javascript" src="{{ $customScript.RelPermalink }}" defer></script> <script type="text/javascript" src="{{ $customScript.RelPermalink }}" defer></script>
{{- end -}} {{- end -}}