diff --git a/quartz/components/scripts/toc.inline.ts b/quartz/components/scripts/toc.inline.ts index acc81b20d..d8160e2c3 100644 --- a/quartz/components/scripts/toc.inline.ts +++ b/quartz/components/scripts/toc.inline.ts @@ -27,8 +27,8 @@ function toggleToc(this: HTMLElement) { } function setupToc() { - const toc = document.getElementById("toc") - if (toc) { + const buttons = document.querySelectorAll("button#toc") as NodeListOf + for (const toc of buttons) { const collapsed = toc.classList.contains("collapsed") const content = toc.nextElementSibling as HTMLElement | undefined if (!content) return