From ea17ae6cbd5bc03589f7cd4834f7ac6b84b018ae Mon Sep 17 00:00:00 2001 From: lzmyhzy Date: Wed, 6 Aug 2025 08:01:00 +0800 Subject: [PATCH] fix: giscus theme will be switched to dark when no 'color-theme' field (#723) --- layouts/_partials/components/giscus.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/layouts/_partials/components/giscus.html b/layouts/_partials/components/giscus.html index 84148c2..fd0cc9d 100644 --- a/layouts/_partials/components/giscus.html +++ b/layouts/_partials/components/giscus.html @@ -14,11 +14,14 @@ function getGiscusTheme() { let giscusTheme = "{{ (string .theme) | default `light` }}"; - if(getHugoTheme() == 'light') { + let hugoTheme = getHugoTheme(); + if(hugoTheme == 'light') { return giscusTheme.replace('dark', 'light'); - } else { + } + if(hugoTheme == 'dark') { return giscusTheme.replace('light', 'dark'); } + return giscusTheme; } function setGiscusTheme() {