From b632af95649ced0895455ba3a693a91fbf73e50b Mon Sep 17 00:00:00 2001 From: Sven Date: Sat, 14 Mar 2026 09:40:48 +0100 Subject: [PATCH] fix(webmention): scope link extraction to .h-entry not .e-content u-in-reply-to, u-like-of, u-repost-of etc. are rendered in an aside before the .e-content div, not inside it. Scoping to .h-entry .e-content caused these microformat links to be missed entirely. Also bump reset-stale migration to v3 so posts already marked sent with zero results (like /replies/88feb/) are retried with the corrected scope. Co-Authored-By: Claude Sonnet 4.6 --- .../patch-webmention-sender-content-scope.mjs | 18 ++++++++++++------ .../patch-webmention-sender-reset-stale.mjs | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/patch-webmention-sender-content-scope.mjs b/scripts/patch-webmention-sender-content-scope.mjs index b4db8701..600e55a7 100644 --- a/scripts/patch-webmention-sender-content-scope.mjs +++ b/scripts/patch-webmention-sender-content-scope.mjs @@ -1,11 +1,16 @@ /** * Patch @rmdes/indiekit-endpoint-webmention-sender webmention.js to: * - * Scope link extraction to the post content area only (.e-content inside - * .h-entry, or
, or
) when processing a full page. + * Scope link extraction to the post content area only (.h-entry, or
, + * or
) when processing a full page. * Without this, links from the sidebar, navigation, and footer are included * because the live-fetch patch fetches the full rendered page HTML. * + * Scopes to the full .h-entry (not just .e-content) so that microformat + * property links like u-in-reply-to, u-like-of, u-repost-of, u-bookmark-of + * are included — these are rendered outside .e-content (e.g. in an aside + * before the prose body) but are still inside the .h-entry root. + * * Falls back to the whole document when no content container is found * (e.g. when processing a stored post body fragment rather than a full page). */ @@ -21,11 +26,12 @@ const originalBlock = ` $("a[href]").each((_, el) => {`; const newBlock = ` // [patched:content-scope] Scope to post content area only, so that // sidebar/nav/footer links from the live-fetched full page are excluded. + // Use .h-entry (not .h-entry .e-content) so that microformat property links + // like u-in-reply-to, u-like-of, u-repost-of etc. are included — these are + // rendered outside .e-content but still inside the .h-entry root. const contentRoot = - $(".h-entry .e-content").first().length - ? $(".h-entry .e-content").first() - : $(".e-content").first().length - ? $(".e-content").first() + $(".h-entry").first().length + ? $(".h-entry").first() : $("article").first().length ? $("article").first() : $("main").first().length diff --git a/scripts/patch-webmention-sender-reset-stale.mjs b/scripts/patch-webmention-sender-reset-stale.mjs index 2039ab3c..d4c8c08a 100644 --- a/scripts/patch-webmention-sender-reset-stale.mjs +++ b/scripts/patch-webmention-sender-reset-stale.mjs @@ -9,7 +9,7 @@ import { MongoClient } from "mongodb"; import config from "../indiekit.config.mjs"; -const MIGRATION_ID = "webmention-sender-reset-stale-v2"; +const MIGRATION_ID = "webmention-sender-reset-stale-v3"; const mongodbUrl = config.application?.mongodbUrl; if (!mongodbUrl) {