From e2c3e465ce689f3b21cf27bc256834d77f7440a3 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 7 Mar 2025 17:26:06 +0800 Subject: refactor: load giscus only with function Former-commit-id: a2f531b7311d485c284121a05ff917be843e54f9 --- layouts/partials/scripts.html | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'layouts/partials/scripts.html') diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 956e88f5..7757e0c0 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -25,30 +25,6 @@ loadToc(); /* === littlefoot === */ littlefoot.littlefoot(littlefootOptions) -/* === giscus === */ -function loadGiscus() { - const giscusContainer = document.querySelector('.giscus'); // Make sure this matches your Giscus container class - if (giscusContainer) { - const script = document.createElement('script'); - script.src = 'https://giscus.app/client.js'; - script.setAttribute('data-repo', '{{ .Site.Params.giscus.repo }}'); - script.setAttribute('data-repo-id', '{{ .Site.Params.giscus.repoId }}'); - script.setAttribute('data-category', '{{ .Site.Params.giscus.category }}'); - script.setAttribute('data-category-id', '{{ .Site.Params.giscus.categoryId }}'); - script.setAttribute('data-mapping', '{{ .Site.Params.giscus.mapping }}'); - script.setAttribute('data-strict', '{{ .Site.Params.giscus.strict }}'); - script.setAttribute('data-reactions-enabled', '{{ .Site.Params.giscus.reactionsEnabled }}'); - script.setAttribute('data-emit-metadata', '{{ .Site.Params.giscus.emitMetadata }}'); - script.setAttribute('data-input-position', '{{ .Site.Params.giscus.inputPosition }}'); - script.setAttribute('data-theme', '{{ .Site.Params.giscus.theme }}'); - script.setAttribute('data-lang', '{{ T "lang" }}'); - script.crossOrigin = 'anonymous'; - script.async = true; - - giscusContainer.appendChild(script); - } -} - /* === swup === */ const swup = new Swup({ linkSelector: 'a[href]:not(.no-swup)' -- cgit v1.2.3