mirror of
https://github.com/JuLi0n21/homepage.git
synced 2026-04-19 23:30:06 +00:00
27 lines
681 B
Plaintext
27 lines
681 B
Plaintext
---
|
|
import { getCollection, render } from 'astro:content';
|
|
import BlogPost from '@layouts/BlogPost.astro';
|
|
import type {
|
|
InferGetStaticParamsType,
|
|
InferGetStaticPropsType,
|
|
GetStaticPaths,
|
|
} from "astro";
|
|
|
|
export const getStaticPaths = (async () => {
|
|
const posts = await getCollection('uni');
|
|
return posts.map(post => ({
|
|
params: { id: post.id },
|
|
props: { post },
|
|
}));
|
|
}) satisfies GetStaticPaths;
|
|
type Params = InferGetStaticParamsType<typeof getStaticPaths>;
|
|
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
|
|
|
|
const { post } = Astro.props;
|
|
const { Content } = await render(post);
|
|
---
|
|
|
|
<BlogPost {...post.data}>
|
|
<Content />
|
|
</BlogPost>
|