mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-04-02 01:54:50 +00:00
30 lines
685 B
Text
30 lines
685 B
Text
|
|
---
|
||
|
|
import { getCollection, render } from "astro:content";
|
||
|
|
import MarkdownPostLayout from "@/layouts/MarkdownPostLayout.astro";
|
||
|
|
|
||
|
|
export async function getStaticPaths() {
|
||
|
|
const posts = await getCollection("blog");
|
||
|
|
const langs = ["zh", "en"];
|
||
|
|
|
||
|
|
return langs.flatMap((lang) =>
|
||
|
|
posts.map((post) => ({
|
||
|
|
params: {
|
||
|
|
lang,
|
||
|
|
slug: post.id,
|
||
|
|
},
|
||
|
|
props: {
|
||
|
|
post,
|
||
|
|
lang,
|
||
|
|
},
|
||
|
|
})),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const { post, lang } = Astro.props;
|
||
|
|
const { Content } = await render(post);
|
||
|
|
---
|
||
|
|
|
||
|
|
<MarkdownPostLayout frontmatter={post.data} lang={lang}>
|
||
|
|
<Content />
|
||
|
|
</MarkdownPostLayout>
|