--- import "~/material/content.css"; import type { GetStaticPaths } from "astro"; import { render } from "astro:content"; import { getCollection } from "astro:content"; import { format } from "date-fns"; import TimeDistanceToNow from "~/components/TimeDistanceToNow/index.astro"; import Regular from "~/layouts/Regular.astro"; import { getPostParam } from "~/utils/posts"; export const getStaticPaths = (async () => { const posts = await getCollection("posts"); return posts.map((x) => ({ params: getPostParam(x), props: { post: x, }, })); }) satisfies GetStaticPaths; const { post } = Astro.props; const { Content } = await render(post); --- {post.data.title} {format(post.data.date, "yyyy/MM/dd")} 创建 { post.data.updated && ( {format(post.data.updated, "yyyy/MM/dd")} 更新 ) } {post.data.visibility === "draft" && This is a draft}