cozy/src/pages/blog/[...id].astro

20 lines
447 B
Text

---
import { type CollectionEntry, getCollection, render } from 'astro:content'
import Blog from '../../layouts/Blog.astro'
export async function getStaticPaths() {
const posts = await getCollection('blog')
return posts.map((post) => ({
params: { id: post.id },
props: post,
}))
}
type Props = CollectionEntry<'blog'>
const post = Astro.props
const { Content } = await render(post)
---
<Blog {...post.data}>
<Content />
</Blog>