summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-04-14 17:45:57 +0800
committerReorx <novoreorx@gmail.com>2022-04-14 17:47:01 +0800
commite91423d6f2803efb006d539386dfcee02387d54b (patch)
tree6be1db12819421225be8380c217f79f48d4ae280
parentad52cd9e5153de1131f519ac101dee1c38aef104 (diff)
use partial instead of partialCached for footer.html
footer has involved a lot of config keys since our fork, sometimes the toc scroll behavior is broken due to cached footer is inconsistant with the current file
-rw-r--r--.github/workflows/gh-pages.yml2
-rw-r--r--Makefile2
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/partials/footer.html2
4 files changed, 5 insertions, 3 deletions
diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml
index 4dff7d2..66e990f 100644
--- a/.github/workflows/gh-pages.yml
+++ b/.github/workflows/gh-pages.yml
@@ -21,7 +21,7 @@ jobs:
hugo-version: '0.91.2'
- name: Build
- run: cd exampleSite && hugo -D --verbose --minify
+ run: cd exampleSite && hugo -D --gc --verbose --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
diff --git a/Makefile b/Makefile
index 859e8d2..289e23a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,2 @@
run-example:
- cd exampleSite && hugo server -D -p 13131
+ cd exampleSite && hugo server -D --gc -p 13131
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 349910a..5a694e7 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -18,7 +18,7 @@
<main class="main {{- if (eq .Kind `page`) -}}{{- print " post" -}}{{- end -}}">
{{- block "main" . }}{{ end }}
</main>
- {{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
+ {{ partial "footer.html" . -}}
{{- block "body_end" . }}{{ end }}
</body>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 8e34467..94cc321 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -158,8 +158,10 @@
for (const listener of scrollListeners) {
window.removeEventListener('scroll', listener)
}
+ window.scrollListeners = []
return
}
+ // console.log('enable toc scroll')
const headings = document.querySelectorAll('h1[id],h2[id],h3[id],h4[id],h5[id]');
const activeClass = 'active';