--- import PageLayout from "../../layouts/PageLayout.astro"; import { getCollection, getEntry, render } from "astro:content"; export const getStaticPaths = async () => { const allArticles = await getCollection("blog"); return allArticles.map((article) => ({ params: { slug: article.id }, props: { article }, })); }; const { slug } = Astro.params; const article = await getEntry("blog", slug); if (!article) { throw new Error(); } const { Content, headings } = await render(article); ---

Table of Contents

    { headings .filter(({ depth }) => depth === 2) .map((heading) => (
  • {heading.text}
  • )) }