From 34c130c324dc9efa7765c5dc97d9760221e00ac3 Mon Sep 17 00:00:00 2001 From: vincent97198 <31513765+vincent97198@users.noreply.github.com> Date: Fri, 27 Mar 2026 03:04:12 +0000 Subject: [PATCH] =?UTF-8?q?fix=20bug=20=E8=B7=9D=E4=BB=8A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=99=82=E9=96=93=20=E5=B0=87=E8=80=83=E6=85=AE?= =?UTF-8?q?=E8=B7=9D=E9=9B=A2=E7=95=B6=E4=B8=8B=E6=99=82=E9=96=93=EF=BC=8C?= =?UTF-8?q?=E8=80=8C=E9=9D=9E=E8=B7=9D=E9=9B=A2=E7=B7=A8=E8=AD=AF=E6=99=82?= =?UTF-8?q?=E9=96=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/posts/[...slug].astro | 81 ++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index efb1e6672..e1bc221b0 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -440,17 +440,18 @@ const relatedPosts = await getRelatedPosts(entry, 5); { siteConfig.showLastModified && (() => { - const lastModified = dayjs( - entry.data.updated || entry.data.published - ); - const now = dayjs(); - const daysDiff = now.diff(lastModified, "day"); - // 使用用户定义的阈值,如果没有定义则默认为1天 + const lastModified = dayjs(entry.data.updated || entry.data.published); + const dateStr = lastModified.format("YYYY-MM-DD"); const outdatedThreshold = siteConfig.outdatedThreshold ?? 1; - const shouldShowOutdatedCard = daysDiff >= outdatedThreshold; - return shouldShowOutdatedCard ? ( -