diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index d2c03d08..c8c3301e 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -173,3 +173,4 @@ params: # emitMetadata: 0 # inputPosition: top # lang: en + # theme: noborder_dark diff --git a/layouts/partials/components/giscus.html b/layouts/partials/components/giscus.html index 8f7edf0f..84148c26 100644 --- a/layouts/partials/components/giscus.html +++ b/layouts/partials/components/giscus.html @@ -8,9 +8,18 @@ * This solution was created with reference to: * https://github.com/giscus/giscus/issues/336#issuecomment-1214366281 */ - function getGiscusTheme() { + function getHugoTheme() { return localStorage.getItem("color-theme"); } + + function getGiscusTheme() { + let giscusTheme = "{{ (string .theme) | default `light` }}"; + if(getHugoTheme() == 'light') { + return giscusTheme.replace('dark', 'light'); + } else { + return giscusTheme.replace('light', 'dark'); + } + } function setGiscusTheme() { function sendMessage(message) {