From 6cce883d0cb57d485bbd1870e9e731c5dac1cdd6 Mon Sep 17 00:00:00 2001 From: ginger <26461046+gingerchew@users.noreply.github.com> Date: Wed, 8 Jan 2025 08:06:18 -0500 Subject: [PATCH] Moves heading check logic into the TableOfContents component --- src/components/TableOfContents.astro | 4 +++- src/layouts/ProseLayout.astro | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro index 4cab6d5..2859777 100644 --- a/src/components/TableOfContents.astro +++ b/src/components/TableOfContents.astro @@ -6,10 +6,12 @@ interface Props { } const { headings } = Astro.props; + +const showTOC = headings && headings.length > 2; --- { - headings?.length && ( + showTOC && (