2026-03-24 22:28:23 +00:00
|
|
|
---
|
|
|
|
|
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);
|
|
|
|
|
---
|
|
|
|
|
|
2026-03-25 10:06:37 +00:00
|
|
|
<MarkdownPostLayout frontmatter={post.data} lang={lang} postId={post.id}>
|
2026-03-24 22:28:23 +00:00
|
|
|
<Content />
|
|
|
|
|
</MarkdownPostLayout>
|