Adds table of contents. Removes now from the top level of the sidebar.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user