orbital-orbit/src/pages/blog/[...slug].astro

19 lines
453 B
Text

---
import { getCollection, render } from "astro:content";
import BlogPostLayout from "../../layouts/BlogPostLayout.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { slug: post.id },
props: { post },
}));
}
const { post } = Astro.props;
const { Content } = await render(post);
---
<BlogPostLayout frontmatter={post.data}>
<Content />
</BlogPostLayout>