Files
pantosite/src/pages/projects/[...slug].astro

23 lines
638 B
Plaintext
Raw Normal View History

2024-12-27 22:05:12 +01:00
---
import { type CollectionEntry, getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro';
import { render } from 'astro:content';
import { convertCollectionPost, convertPost, type Post } from '../../models/Post';
export async function getStaticPaths() {
const posts: Post[] = (await getCollection('projects')).map(convertPost);
return posts.map((post) => ({
params: { slug: post.id },
props: post,
}));
}
type Props = CollectionEntry<'projects'>;
const post: Post = Astro.props;
const { Content } = await render(convertCollectionPost(post));
---
<BlogPost {...post}>
<Content />
</BlogPost>