diff options
| -rw-r--r-- | layouts/partials/footer.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 4e348be..ab4496c 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -138,9 +138,12 @@ </script> {{- end }} -{{- if (and (eq .Kind "page") (.Param "ShowToc") (.Param "TocSide")) }} +{{- if (and (eq .Kind "page") (.Content) (.Param "ShowToc") (.Param "TocSide")) }} <script> window.addEventListener('DOMContentLoaded', function (event) { + if (!document.querySelector('.toc')) { + return; + } const headings = document.querySelectorAll('h1[id],h2[id],h3[id],h4[id],h5[id]'); const activeClass = 'active'; |
