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 ? ( -