summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-01-06 09:59:10 +0800
committerEltrac <hi@guhub.cn>2025-01-06 09:59:10 +0800
commitfc792739392696817f36374640e4b09a4b997615 (patch)
tree1118656fcdeb0614825a011a86f8d0ba0b397e7d
parent9e1fb0181ca828d96e0cd8cd3a34b981e09e0a18 (diff)
feat(theme): add littlefoot.js
-rw-r--r--hugo.yaml2
-rw-r--r--layouts/partials/head/headscript.html5
-rw-r--r--layouts/partials/scripts.html5
3 files changed, 11 insertions, 1 deletions
diff --git a/hugo.yaml b/hugo.yaml
index 744f8a08..22770b69 100644
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -24,11 +24,13 @@ params:
extraCSSFiles:
- https://unpkg.com/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.css
- https://unpkg.com/@waline/client@v3/dist/waline.css
+ - https://unpkg.com/littlefoot/dist/littlefoot.css
externalJSFIles:
- https://unpkg.com/swup@4
- https://unpkg.com/tocbot@4.32.2/dist/tocbot.min.js
- https://unpkg.com/vanilla-lazyload@19.1.3/dist/lazyload.min.js
- https://unpkg.com/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.umd.js
+ - https://unpkg.com/littlefoot/dist/littlefoot.js
nav:
- name: 关于
link: /about/
diff --git a/layouts/partials/head/headscript.html b/layouts/partials/head/headscript.html
index 70496834..06835b1c 100644
--- a/layouts/partials/head/headscript.html
+++ b/layouts/partials/head/headscript.html
@@ -1,5 +1,10 @@
<!-- Global JavaScript Variables -->
<script>
+/* === littlefoot options === */
+var littlefootOptions = {
+ dismissOnUnhover: true
+}
+
/* === umami tracking === */
if (window.location.hostname !== 'localhost') {
// track traffic
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 37a427c6..e1babce6 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -22,12 +22,15 @@ function loadToc() {
}
loadToc();
+/* === littlefoot === */
+littlefoot.littlefoot(littlefootOptions)
+
/* === swup === */
const swup = new Swup();
swup.hooks.on('page:view', () => {
- loadWalineComment();
lazyLoadInstance.update();
Fancybox.bind("[data-fancybox]");
loadToc();
+ littlefoot.littlefoot(littlefootOptions)
});
</script>