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 <noreply@anthropic.com>
This commit is contained in:
Neeldhara Misra 2026-02-20 16:02:18 +05:30
parent 7cbf8c8f10
commit bf14d02121

View file

@ -86,7 +86,7 @@ const { Content, headings } = await render(post);
) : null
}
</div>
{headings.length > 0 && <TableOfContents headings={headings} />}
{headings.filter(h => h.depth === 2).length > 0 && <TableOfContents headings={headings} />}
<article class="animate">
<Content />
<div class="mt-24">