{# 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 %} {# 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 #} {% macro author_card(wm, class='', photo_size=48, show_name=True) %} {%- if wm.author_photo %} {%- 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) }}
{%- 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 #} {% macro mention(wm) %}
{{ author_card(wm, photo_size=24) }} {% if wm.content_snippet %}

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

{% endif %} {{ response_time(wm) }}
{%- endmacro %}