Adds table of contents. Removes now from the top level of the sidebar.

This commit is contained in:
2026-05-26 17:10:01 -07:00
parent 5c90096a10
commit bcc2d85560
7 changed files with 105 additions and 6 deletions

View File

@@ -14,9 +14,9 @@ type Props = CollectionEntry<'blog'>;
const post = Astro.props;
const { slug } = Astro.params;
const { Content } = await render(post);
const { Content, headings } = await render(post);
---
<BlogPost slug={slug} {...post.data} >
<BlogPost slug={slug} headings={headings} {...post.data} >
<Content />
</BlogPost>

View File

@@ -2,6 +2,7 @@
import RootLayout from '../../layouts/RootLayout.astro';
import NotchedBox from '../../components/NotchedBox.astro';
import FormattedDate from '../../components/FormattedDate.astro';
import TableOfContents from '../../components/TableOfContents.astro';
import { type CollectionEntry, getCollection } from 'astro:content';
import { render } from 'astro:content';
@@ -15,7 +16,7 @@ export async function getStaticPaths() {
type Props = CollectionEntry<'notes'>;
const note = Astro.props;
const { Content } = await render(note);
const { Content, headings } = await render(note);
---
<RootLayout>
@@ -24,6 +25,7 @@ const { Content } = await render(note);
<div class="last-updated">
Last updated <FormattedDate date={note.data.updated} />
</div>
<TableOfContents headings={headings}/>
<Content />
</NotchedBox>
</RootLayout>