Uncaptioned photos rendered alt="Image", which mf2 parsers report as the photo's alt text. They now take the post's text (excerpt, up to 150 characters), falling back to "Image" only for text-free posts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
601 B
HTML
18 lines
601 B
HTML
{# Reusable media display macro #}
|
|
{# fallback_alt: for photos without a caption, usually the post's text (v2.6.5) #}
|
|
{% macro display_media(media_items, fallback_alt='') %}
|
|
{% if media_items %}
|
|
<div class="note-media">
|
|
{% for item in media_items %}
|
|
<figure class="media-item">
|
|
<img src="{{ url_for('public.media_file', path=item.path) }}"
|
|
alt="{{ item.caption or fallback_alt or 'Image' }}"
|
|
class="u-photo"
|
|
loading="lazy">
|
|
{# No figcaption - caption is for alt text only #}
|
|
</figure>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|