Files
blazestar.net/src/pages/blog/[...slug].astro

23 lines
570 B
Plaintext

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