summaryrefslogtreecommitdiff
path: root/layouts/partials/head/headscript.html
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-31 15:48:06 +0800
committerEltrac <hi@guhub.cn>2025-03-31 15:48:06 +0800
commite2acf0e10c83acd322853aac9fab341c8d91b7f3 (patch)
treefdbc8d8ce72618c05c9b36a2d347e16dafeb2729 /layouts/partials/head/headscript.html
parented628a0a4983dd0b21030b365558b514d7ac6d1f (diff)
refactor: encapsulate giscus and heatmap component
- move giscus script to comment.html - move heatmap dependency to its component file to avoid loading it when not needed - delete headscript partial
Diffstat (limited to 'layouts/partials/head/headscript.html')
-rw-r--r--layouts/partials/head/headscript.html39
1 files changed, 0 insertions, 39 deletions
diff --git a/layouts/partials/head/headscript.html b/layouts/partials/head/headscript.html
deleted file mode 100644
index ed68e4c8..00000000
--- a/layouts/partials/head/headscript.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<script src="https://d3js.org/d3.v7.min.js"></script>
-<script src="https://unpkg.com/cal-heatmap/dist/cal-heatmap.min.js"></script>
-<script>
-/* === umami tracking === */
-if (window.location.hostname !== 'localhost') {
- // track traffic
- const script = document.createElement('script');
- script.defer = true;
- script.src = 'https://cloud.umami.is/script.js';
- script.dataset.websiteId = 'ae8c2619-56eb-4577-ac31-9dc6ea44bda7';
- document.head.appendChild(script);
-}
-
-/* === giscus === */
-function loadGiscus() {
- const giscusContainer = document.querySelector('.giscus'); // Make sure this matches your Giscus container class
- const giscusScript = document.getElementById('giscus-script');
- if (giscusContainer && !giscusScript) {
- const script = document.createElement('script');
- script.id = "giscus-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;
-
- document.body.appendChild(script);
- }
-}
-</script>