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
This commit is contained in:
Reorx 2022-04-14 17:45:57 +08:00
parent ad52cd9e51
commit e91423d6f2
4 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,7 @@ jobs:
hugo-version: '0.91.2' hugo-version: '0.91.2'
- name: Build - name: Build
run: cd exampleSite && hugo -D --verbose --minify run: cd exampleSite && hugo -D --gc --verbose --minify
- name: Deploy - name: Deploy
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3

View File

@ -1,2 +1,2 @@
run-example: run-example:
cd exampleSite && hugo server -D -p 13131 cd exampleSite && hugo server -D --gc -p 13131

View File

@ -18,7 +18,7 @@
<main class="main {{- if (eq .Kind `page`) -}}{{- print " post" -}}{{- end -}}"> <main class="main {{- if (eq .Kind `page`) -}}{{- print " post" -}}{{- end -}}">
{{- block "main" . }}{{ end }} {{- block "main" . }}{{ end }}
</main> </main>
{{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}} {{ partial "footer.html" . -}}
{{- block "body_end" . }}{{ end }} {{- block "body_end" . }}{{ end }}
</body> </body>

View File

@ -158,8 +158,10 @@
for (const listener of scrollListeners) { for (const listener of scrollListeners) {
window.removeEventListener('scroll', listener) window.removeEventListener('scroll', listener)
} }
window.scrollListeners = []
return return
} }
// console.log('enable toc scroll')
const headings = document.querySelectorAll('h1[id],h2[id],h3[id],h4[id],h5[id]'); const headings = document.querySelectorAll('h1[id],h2[id],h3[id],h4[id],h5[id]');
const activeClass = 'active'; const activeClass = 'active';