summaryrefslogtreecommitdiff
path: root/layouts/partials/scripts.html
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-02-07 22:42:00 +0800
committerEltrac <hi@guhub.cn>2025-02-07 22:42:00 +0800
commitbe8690f51528410b4f71a1d84603bdf2bad21d01 (patch)
treeef7adc6ccea29e629db381a90b84d31bf98d501b /layouts/partials/scripts.html
parent47aa45c32efe5b617eaf7dcdc7d4e73d0499f397 (diff)
refactor: move giscus configuration to site yaml
Diffstat (limited to 'layouts/partials/scripts.html')
-rw-r--r--layouts/partials/scripts.html24
1 files changed, 10 insertions, 14 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 95010ada..956e88f5 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -29,22 +29,18 @@ littlefoot.littlefoot(littlefootOptions)
function loadGiscus() {
const giscusContainer = document.querySelector('.giscus'); // Make sure this matches your Giscus container class
if (giscusContainer) {
- // Remove old Giscus iframe
- giscusContainer.innerHTML = '';
-
- // Create and append a new script
const script = document.createElement('script');
script.src = 'https://giscus.app/client.js';
- script.setAttribute('data-repo', 'your/repo');
- script.setAttribute('data-repo-id', 'your-repo-id');
- script.setAttribute('data-category', 'General');
- script.setAttribute('data-category-id', 'your-category-id');
- script.setAttribute('data-mapping', 'pathname');
- script.setAttribute('data-strict', '0');
- script.setAttribute('data-reactions-enabled', '1');
- script.setAttribute('data-emit-metadata', '0');
- script.setAttribute('data-input-position', 'bottom');
- script.setAttribute('data-theme', 'light');
+ 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;