fix: remove duplicate mastodon webmention cards client-side
Build & Deploy / build-and-deploy (push) Successful in 2m1s

Build-time Nunjucks filter only removes static webmentions. Client-side
webmention fetcher (webmentions.js) adds NEW cards after page load, bypassing
the filter. After mastodon replies load, remove any li[data-author-url] cards
whose author URL matches a mastodon reply — keeing the richer Alpine card.
This commit is contained in:
svemagie
2026-04-20 18:28:08 +02:00
parent d0e2529911
commit c13eddacb1
+7
View File
@@ -97,6 +97,13 @@ document.addEventListener("alpine:init", () => {
published: s.created_at,
favourites: s.favourites_count || 0,
}));
// Remove webmention cards (build-time or client-fetched) that duplicate mastodon replies.
// Webmention cards have data-author-url; Alpine x-for cards do not.
const mastodonAuthorUrls = new Set(this.mastodonReplies.map((r) => r.author.url));
document.querySelectorAll(".webmention-replies li[data-author-url]").forEach((li) => {
if (mastodonAuthorUrls.has(li.dataset.authorUrl)) li.remove();
});
} catch {
// fail silently
}