diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro
new file mode 100644
index 0000000..f24d5a9
--- /dev/null
+++ b/src/components/TableOfContents.astro
@@ -0,0 +1,59 @@
+---
+import type { MarkdownHeading } from 'astro';
+
+type Props = {
+ headings: MarkdownHeading[];
+};
+
+type HeadingWithSubheadings = MarkdownHeading & {
+ subheadings: MarkdownHeading[];
+};
+
+const { headings } = Astro.props;
+
+const grouppedHeadings = headings.reduce((array, heading) => {
+ if (heading.depth === 2) {
+ array.push({ ...heading, subheadings: [] });
+ } else if (heading.depth === 3) {
+ array.at(-1)?.subheadings.push(heading);
+ }
+
+ return array;
+}, [] as HeadingWithSubheadings[]);
+---
+
+
+
+