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