summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/partials/scripts.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index b77a3f73..9c980c77 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -25,6 +25,34 @@ loadToc();
/* === littlefoot === */
littlefoot.littlefoot(littlefootOptions)
+/* === giscus === */
+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-lang', 'en');
+ script.crossOrigin = 'anonymous';
+ script.async = true;
+
+ giscusContainer.appendChild(script);
+ }
+}
+
/* === swup === */
const swup = new Swup({
linkSelector: 'a[href]:not(.no-swup)'
@@ -36,5 +64,6 @@ swup.hooks.on('page:view', () => {
littlefoot.littlefoot(littlefootOptions);
initCalHeatmap();
initPagefind();
+ loadGiscus();
});
</script>