mirror of
https://github.com/Pantonius/pantosite-astro.git
synced 2026-04-26 09:24:38 +00:00
Very first version of pantosite-astro
This commit is contained in:
22
src/pages/projects/[...slug].astro
Normal file
22
src/pages/projects/[...slug].astro
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
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>
|
||||
Reference in New Issue
Block a user