new.fosc.space/src/pages/blog/[...slug].astro

20 lines
459 B
Plaintext

---
import { type CollectionEntry, getCollection } from 'astro:content';
import Layout from '../../layouts/new.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 {...post.data}>
<Content></Content>
</Layout>