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>
47 lines
2.0 KiB
HTML
47 lines
2.0 KiB
HTML
{# One note in a list (home, tag pages). v2.3.0 #}
|
|
{% from "partials/media.html" import display_media %}
|
|
{% from "partials/reaction.html" import reaction %}
|
|
{% macro note_preview(note, author) %}
|
|
<article class="h-entry note-preview">
|
|
{# Notes starting with a # heading have a title (Q22) #}
|
|
{% set has_explicit_title = note.content.strip().startswith('#') %}
|
|
{% if has_explicit_title %}
|
|
<h2 class="p-name"><a href="{{ absolute_url_for('public.note', slug=note.slug) }}">{{ note.title }}</a></h2>
|
|
{% endif %}
|
|
|
|
{% if note.in_reply_to %}
|
|
<p class="reaction reply-to"><span class="reaction-verb">↩ In reply to</span> <a class="u-in-reply-to" href="{{ note.in_reply_to }}">{{ note.in_reply_to }}</a></p>
|
|
{% endif %}
|
|
|
|
{{ reaction(note) }}
|
|
|
|
{{ display_media(note.media, note.excerpt|truncate(150)) }}
|
|
|
|
{% if has_explicit_title %}
|
|
{# Titled notes are articles: show a summary and link through #}
|
|
<div class="p-summary">
|
|
<p>{{ note.excerpt }}</p>
|
|
</div>
|
|
<p class="read-more"><a href="{{ absolute_url_for('public.note', slug=note.slug) }}">Read more →</a></p>
|
|
{% else %}
|
|
{# Always present, even empty: without it a text-free photo post gets an implied name (mf2) #}
|
|
<div class="e-content">
|
|
{{ note.html|safe }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<footer class="note-meta">
|
|
<a class="u-url" href="{{ absolute_url_for('public.note', slug=note.slug) }}"><time class="dt-published" datetime="{{ note.created_at.isoformat() }}">{{ note.created_at.strftime('%b %-d, %Y') }}</time></a>
|
|
{% if note.tags %}
|
|
<span class="note-tags">
|
|
{% for tag in note.tags %}<a class="p-category" rel="tag" href="{{ url_for('public.tag', tag=tag.name) }}">{{ tag.display_name }}</a>{% endfor %}
|
|
</span>
|
|
{% endif %}
|
|
{% if author %}
|
|
{# Single-author site: keep the h-card for parsers, hide it from readers #}
|
|
<span class="p-author h-card visually-hidden"><a class="p-name u-url" href="{{ author.url or author.me }}">{{ author.name or author.url or author.me }}</a></span>
|
|
{% endif %}
|
|
</footer>
|
|
</article>
|
|
{% endmacro %}
|