From 3efbe9c73ed6878d158427d484800bba92d96dbd Mon Sep 17 00:00:00 2001 From: shandianchengzi <1252402849@qq.com> Date: Fri, 5 Apr 2024 20:15:46 +0800 Subject: [PATCH 1/3] Posts: add post information below the post. --- pages/src/content/config.ts | 4 ++++ pages/src/layouts/PostDetails.astro | 30 +++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/pages/src/content/config.ts b/pages/src/content/config.ts index 71498b1..66ffd11 100644 --- a/pages/src/content/config.ts +++ b/pages/src/content/config.ts @@ -16,6 +16,10 @@ const blog = defineCollection({ [z.date(), z.string(), z.number()] ).default(""), link: z.string().url().default(""), + proofreader: z.string().default(SITE.author), + proofread_date: z.union( + [z.date(), z.string(), z.number()] + ).default(""), }), }); diff --git a/pages/src/layouts/PostDetails.astro b/pages/src/layouts/PostDetails.astro index b10978b..2988fc7 100644 --- a/pages/src/layouts/PostDetails.astro +++ b/pages/src/layouts/PostDetails.astro @@ -13,7 +13,7 @@ export interface Props { const { post } = Astro.props; -const { title, author } = post.data; +const { title, author, collected_date, collector, translated_date, translator, link, proofreader, proofread_date } = post.data; const { Content } = await post.render(); @@ -60,6 +60,32 @@ const layoutProps = {
+
+
+ + { + translated_date && ( +

译自: {link}

+

+ 译者: + {translator} + { + proofread_date && ( + 校对:{proofreader} +

本文由HCTT原创翻译,华科开放原子俱乐部荣誉推出。

+ ) + } +

+ ) + } + + { + !translated_date && ( +

原文链接: {link}

+ ) + } + +
@@ -68,7 +94,7 @@ const layoutProps = {
+ >