From a33dce799a0be2c71f6fff19218be9667642d55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E5=8F=89=E6=A0=91=E6=A0=91?= Date: Sun, 25 Jan 2026 21:43:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(NewPostNotification):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A3=80=E6=B5=8B=E9=80=BB=E8=BE=91=E4=BB=A5?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E6=A0=87=E9=A2=98=E5=92=8C=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前仅检测内容变更和发布日期更新,现在扩展检测逻辑以包含标题、描述等元数据的变更,确保任何修改都能正确触发更新通知。 --- .../widget/NewPostNotification.astro | 23 +++++++++++-------- src/content/posts/pin.md | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/widget/NewPostNotification.astro b/src/components/widget/NewPostNotification.astro index 78b3c2748..148dbcdf7 100644 --- a/src/components/widget/NewPostNotification.astro +++ b/src/components/widget/NewPostNotification.astro @@ -486,16 +486,21 @@ // New post detectedChanges.push({ ...post, isUpdated: false }); } else { - const dateUpdated = post.pubDate > stored.pubDate; - const contentChanged = post.content && stored.content && post.content !== stored.content; + // Check for ANY change (Title, Date, Description, Content) + const titleChanged = post.title !== stored.title; + const dateChanged = post.pubDate !== stored.pubDate; + const descriptionChanged = post.description !== stored.description; + const contentChanged = post.content !== stored.content; - if (contentChanged) { - const diff = computeDiff(stored.content, post.content); - if (diff) { - detectedChanges.push({ ...post, isUpdated: true, diff }); - } - } else if (dateUpdated) { - detectedChanges.push({ ...post, isUpdated: true }); + if (titleChanged || dateChanged || descriptionChanged || contentChanged) { + // Calculate diff only if content changed + const diff = contentChanged ? computeDiff(stored.content, post.content) : null; + + detectedChanges.push({ + ...post, + isUpdated: true, + diff + }); } } }); diff --git a/src/content/posts/pin.md b/src/content/posts/pin.md index b89d16172..ea5c47d24 100644 --- a/src/content/posts/pin.md +++ b/src/content/posts/pin.md @@ -3,7 +3,7 @@ title: 加群向导 image: /random/h published: 2025-05-24 pinned: true -description: 关于如何联系二叉树树~ 开始技术切磋! +description: 关于如何联系二叉树树~ ---