diff --git a/src/components/Sidebar.astro b/src/components/Sidebar.astro
index 5aea431..597fa15 100644
--- a/src/components/Sidebar.astro
+++ b/src/components/Sidebar.astro
@@ -12,7 +12,6 @@ import SocialLinks from './SocialLinks.astro';
Home
Blog
About
- Now
diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro
new file mode 100644
index 0000000..e8e1045
--- /dev/null
+++ b/src/components/TableOfContents.astro
@@ -0,0 +1,31 @@
+---
+import TableOfContentsTree from "./TableOfContentsTree.astro";
+import type { MarkdownHeading } from "astro";
+import { makeHeadingsTree, removeEmptyLevels } from "../lib/headings";
+
+type Props = {
+ headings: Array
;
+};
+
+const {headings} = Astro.props;
+const headingsTree = removeEmptyLevels(makeHeadingsTree(headings));
+---
+
+
+
+
diff --git a/src/components/TableOfContentsTree.astro b/src/components/TableOfContentsTree.astro
new file mode 100644
index 0000000..b22eb50
--- /dev/null
+++ b/src/components/TableOfContentsTree.astro
@@ -0,0 +1,15 @@
+---
+type Props = {
+ headingsTree: HeadingsTree;
+};
+
+const {headingsTree} = Astro.props;
+---
+
+
+ {headingsTree.map(node =>
+ Array.isArray(node)
+ ?
+ : - {node.text}
+ )}
+
diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro
index 40f4f6d..5580888 100644
--- a/src/layouts/BlogPost.astro
+++ b/src/layouts/BlogPost.astro
@@ -1,13 +1,15 @@
---
+import type { MarkdownHeading } from "astro";
import type { CollectionEntry } from 'astro:content';
import RootLayout from '../layouts/RootLayout.astro';
import FormattedDate from '../components/FormattedDate.astro';
import NotchedBox from '../components/NotchedBox.astro';
+import TableOfContents from '../components/TableOfContents.astro';
import { Image } from 'astro:assets';
-type Props = CollectionEntry<'blog'>['data'] & { slug: string; };
+type Props = CollectionEntry<'blog'>['data'] & { slug: string; headings: MarkdownHeading[] };
-const { slug, title, description, pubDate, updatedDate, heroImage, tags } = Astro.props;
+const { slug, title, description, pubDate, updatedDate, heroImage, tags, headings } = Astro.props;
---