---
import { getCollection, getEntry, render } from "astro:content";
import MarkdownPostsLayout from "../../layouts/MarkdownPostsLayout.astro";

export const prerender = true;
export async function getStaticPaths() {
    const postEntries = await getCollection("posts");
    return postEntries.map((entry) => ({
        params: { slug: entry.id },
        props: { entry },
    }));
}

const { entry } = Astro.props;
const { Content, headings } = await render(entry);
---

<MarkdownPostsLayout frontmatter={entry.data}>
    <Content />
</MarkdownPostsLayout>
