Add blog post detail page

This commit is contained in:
Lewis Wynne 2026-01-23 00:12:20 +00:00
parent be88d18dcc
commit bb1b30fc2d

View file

@ -0,0 +1,25 @@
---
import { getCollection, render } from 'astro:content';
import '../styles/global.css';
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);
---
<!DOCTYPE html>
<html>
<head><title>{post.data.title}</title></head>
<body>
<article>
<h1>{post.data.title}</h1>
<Content />
</article>
</body>
</html>