From 9c8fb2a341c782cc49c7ac313e2ec0d7c7dba08d Mon Sep 17 00:00:00 2001 From: svemagie Date: Mon, 20 Apr 2026 17:25:39 +0200 Subject: [PATCH] feat: merge Bluesky thread replies into webmention replies section --- _includes/components/webmentions.njk | 63 +++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/_includes/components/webmentions.njk b/_includes/components/webmentions.njk index 521b620..747fdb7 100644 --- a/_includes/components/webmentions.njk +++ b/_includes/components/webmentions.njk @@ -110,15 +110,30 @@ {% endif %} - {# Replies #} - {% set replies = mentions | webmentionsByType('replies') %} - {% if replies.length %} -
-

- {{ replies.length }} Repl{% if replies.length != 1 %}ies{% else %}y{% endif %} + {# Replies — webmention replies merged with Bluesky thread (deduplicated) #} + {% set wm_replies = mentions | webmentionsByType('replies') %} + {% set bskySyndUrl = "" %} + {% if syndication %} + {% for url in syndication %} + {% if "bsky.app" in url %}{% set bskySyndUrl = url %}{% endif %} + {% endfor %} + {% endif %} + {# Filter out Bluesky-sourced webmention replies when a direct thread is available #} + {% set filtered_replies = [] %} + {% for reply in wm_replies %} + {% set src = reply['wm-source'] | default('') %} + {% if not bskySyndUrl or ('bsky.app' not in src and 'brid.gy' not in src and 'bridgy' not in src) %} + {% set filtered_replies = (filtered_replies.push(reply), filtered_replies) %} + {% endif %} + {% endfor %} + {% if filtered_replies.length or bskySyndUrl %} +
+

+ {% if not bskySyndUrl %}{{ filtered_replies.length }} Repl{% if filtered_replies.length != 1 %}ies{% else %}y{% endif %}{% endif %}

    - {% for reply in replies %} + {% for reply in filtered_replies %}
{% endfor %} + {% if bskySyndUrl %} + + {% endif %}

{% endif %} @@ -201,9 +247,6 @@ {% endif %} -{# Bluesky Thread — AT Protocol replies from syndicated post #} -{% include "components/bluesky-thread.njk" %} - {# Webmention send form — collapsed by default #}