Published on February 18, 2025
Post content
---
import { getCollection, render } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('posts');
return posts.map(post => ({
params: { slug: post.id }, props: { post },
}));
}
const { post } = Astro.props;
const { Content } = await render(post);
---
<h1>{post.data.title}</h1>
{post.data.tags?.length > 0 &&
<ul>
{post.data.tags.map(tag => <li>{tag}</li>)}
</ul>
}
<Content />