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'
- 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

View File

@ -1,2 +1,2 @@
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 -}}">
{{- block "main" . }}{{ end }}
</main>
{{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
{{ partial "footer.html" . -}}
{{- block "body_end" . }}{{ end }}
</body>

View File

@ -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';