diff --git a/src/content.config.ts b/src/content.config.ts index 26eeba4..2068e18 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -15,6 +15,7 @@ const postsCollection = defineCollection({ category: z.string().optional().nullable().default(""), showcover: z.boolean().optional().default(true), customcover: z.string().optional().default(""), + outdated: z.boolean().optional().default(false), lang: z.string().optional().default(""), prevTitle: z.string().default(""), prevSlug: z.string().default(""), diff --git a/src/content/posts/codex-warp.md b/src/content/posts/codex-warp.md index 8d4bfd1..7d5a51f 100644 --- a/src/content/posts/codex-warp.md +++ b/src/content/posts/codex-warp.md @@ -7,6 +7,7 @@ showcover: false customcover: /public/pic/codex-warp-banner.png tags: ["Codex", "Warp", "注册机", "AI"] category: '教程' +outdated: true --- # 前言 diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 253e6b5..3a3d332 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -57,6 +57,7 @@ const showcover = entry.data.showcover; // 获取自定义的头图(Markdown 内部) const customcover = entry.data.customcover; +const isOutdated = entry.data.outdated; --- @@ -114,12 +115,26 @@ const customcover = entry.data.customcover; )} -
+
- +
- 本文最后更新于 {lastUpdatedLabel},距今 计算中...。 - 随着时间推移,文中描述可能与当前实际情况有出入,请注意甄别。 + {isOutdated ? ( + <>本文内容部分或全部可能已失效,请谨慎参考。 + ) : ( + <> + 本文最后更新于 {lastUpdatedLabel},距今 计算中...。 + 随着时间推移,文中描述可能与当前实际情况有出入,请注意甄别。 + + )}