From bf14d021216e66e8dde84828f63a2224ff7407bc Mon Sep 17 00:00:00 2001 From: Neeldhara Misra Date: Fri, 20 Feb 2026 16:02:18 +0530 Subject: [PATCH] Only show TOC when post has h2+ headings Short posts without section headers don't need a table of contents. Now the TOC only appears when there are actual h2 headings to navigate. Co-Authored-By: Claude Opus 4.5 --- src/pages/blog/[...id].astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/blog/[...id].astro b/src/pages/blog/[...id].astro index bc3e362..24fcb17 100644 --- a/src/pages/blog/[...id].astro +++ b/src/pages/blog/[...id].astro @@ -86,7 +86,7 @@ const { Content, headings } = await render(post); ) : null } - {headings.length > 0 && } + {headings.filter(h => h.depth === 2).length > 0 && }