From e91423d6f2803efb006d539386dfcee02387d54b Mon Sep 17 00:00:00 2001 From: Reorx Date: Thu, 14 Apr 2022 17:45:57 +0800 Subject: [PATCH] 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 --- .github/workflows/gh-pages.yml | 2 +- Makefile | 2 +- layouts/_default/baseof.html | 2 +- layouts/partials/footer.html | 2 ++ 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 @@
{{- block "main" . }}{{ end }}
- {{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}} + {{ partial "footer.html" . -}} {{- block "body_end" . }}{{ end }} 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';