diff --git a/assets/js/theme.js b/assets/js/theme.js index 8930752a..edc87c49 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -854,7 +854,7 @@ class FixIt { const giscusConfig = this.config.comment.giscus; this._giscusOnSwitchTheme = this._giscusOnSwitchTheme || (() => { const message = { setConfig: { theme: this.isDark ? giscusConfig.darkTheme : giscusConfig.lightTheme }}; - document.querySelector('.giscus-frame')?.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); + document.querySelector('.giscus-frame')?.contentWindow.postMessage({ giscus: message }, giscusConfig.origin); }); this.switchThemeEventSet.add(this._giscusOnSwitchTheme); this.giscus2parentMsg = window.addEventListener('message', (event) => { diff --git a/hugo.toml b/hugo.toml index bdc2010e..fc3c7b68 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1109,6 +1109,7 @@ enableEmoji = true category = "" categoryId = "" mapping = "" + origin = "https://giscus.app" # Or set it to your self-hosted domain strict = "0" # FixIt NEW | 0.2.18 term = "" reactionsEnabled = "1" diff --git a/layouts/partials/single/comment.html b/layouts/partials/single/comment.html index b2000421..95b41a1f 100644 --- a/layouts/partials/single/comment.html +++ b/layouts/partials/single/comment.html @@ -299,11 +299,12 @@ {{- $giscus := $comment.giscus | default dict -}} {{- if $giscus.enable -}} {{- with $giscus -}} + {{- $commentConfig = .origin | default "https://giscus.app" | dict "origin" | dict "giscus" | merge $commentConfig -}} {{- $commentConfig = .lightTheme | default "light" | dict "lightTheme" | dict "giscus" | merge $commentConfig -}} {{- $commentConfig = .darkTheme | default "dark" | dict "darkTheme" | dict "giscus" | merge $commentConfig -}}