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:
parent
7cbf8c8f10
commit
bf14d02121
1 changed files with 1 additions and 1 deletions
|
|
@ -86,7 +86,7 @@ const { Content, headings } = await render(post);
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
{headings.length > 0 && <TableOfContents headings={headings} />}
|
{headings.filter(h => h.depth === 2).length > 0 && <TableOfContents headings={headings} />}
|
||||||
<article class="animate">
|
<article class="animate">
|
||||||
<Content />
|
<Content />
|
||||||
<div class="mt-24">
|
<div class="mt-24">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue