popov.link/src/pages/blog/[...slug].astro

21 lines
440 B
Plaintext
Raw Normal View History

2024-09-04 21:16:37 +00:00
---
import { type CollectionEntry, getCollection } from "astro:content";
import Layout from "../../layouts/PostLayout.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { slug: post.slug },
props: post,
}));
}
type Props = CollectionEntry<"blog">;
const post = Astro.props;
const { Content } = await post.render();
---
<Layout>
<Content />
</Layout>