{# Received webmentions as microformats2 responses (v2.8.0) Each response is an h-cite in a property of the note's h-entry: u-comment (replies), u-like, u-repost, u-bookmark, u-mention. See https://indieweb.org/comments-presentation and microformats.org/wiki/h-entry #} {# When the source said when it was posted, use that; else when we received it #} {% macro response_time(wm, fmt='%B %-d, %Y') %} {% set when = wm.source_published or wm.received_at %} {%- endmacro %} {# The response's own URL: the source's u-url if it gave one #} {% macro response_url(wm) %}{{ wm.source_post_url or wm.source_url }}{% endmacro %} {# Where a backfed response came from, e.g. "via Bluesky" (v2.13.0) #} {% macro via(wm) %}{% if wm.via %}via {{ wm.via }}{% endif %}{% endmacro %} {# Author h-card: name, URL and photo. u-url is on an inner link: on the h-card element itself it would belong to the enclosing h-cite. The photo is this site's saved copy (v2.13.0); until there is one, the initial is shown instead of loading it from the other site. #} {% macro author_card(wm, class='', photo_size=48, show_name=True) %} {% set photo = wm.author_photo|local_avatar %} {%- if photo %} {%- elif wm.author_photo %}{% if not show_name %}{% endif %} {%- elif not show_name %} {%- endif %} {{ wm.author_name or 'Anonymous' }} {%- endmacro %} {# A reply, shown as a comment #} {% macro reply(wm) %}
{{ author_card(wm) }}
{% if wm.content_snippet %}
{{ wm.content_snippet|safe }}
{% endif %} {{ response_time(wm) }} {{ via(wm) }}
{%- endmacro %} {# Likes, reposts or bookmarks as a facepile; prop is u-like / u-repost / u-bookmark. Faces past `shown` are hidden on screen but kept for parsers. #} {% macro facepile(items, prop, shown=8) %}
{% for wm in items %} shown %} hidden{% endif %}> {{ author_card(wm, photo_size=32, show_name=False) }} {% endfor %} {% if items|length > shown %} +{{ items|length - shown }} others {% endif %}
{%- endmacro %} {# A post that mentions this note without replying; also quote posts (v2.13.0) #} {% macro mention(wm) %}
{{ author_card(wm, photo_size=24) }} {% if wm.content_snippet %}

{{ wm.content_snippet|striptags|truncate(200) }}

{% endif %} {{ response_time(wm) }} {{ via(wm) }}
{%- endmacro %} {# Like, repost and quote counts a silo reports without saying who (Threads, v2.13.0). Plain text: these aren't people, so no u-like / h-cite. #} {% macro silo_counts(syndications) %} {% for s in syndications or [] if s.likes_count or s.reposts_count or s.quotes_count %} {% set parts = [] %} {% for n, one, many in [(s.likes_count, 'like', 'likes'), (s.reposts_count, 'repost', 'reposts'), (s.quotes_count, 'quote', 'quotes')] if n %}{% set _ = parts.append(n ~ ' ' ~ (one if n == 1 else many)) %}{% endfor %}

On {{ s.name }}: {{ parts|join(' ยท ') }}

{% endfor %} {%- endmacro %}