Files
StarPunk/templates/partials/note_preview.html
T
PhilandClaude Opus 5.5 b7f8e1612c feat: articles at /article/<slug> with slugs from their titles (v2.17.0, ADR-077)
Articles (notes with a title) move from /note/<slug> to /article/<slug>;
the other prefix 301-redirects. New articles take their slug from the
title (mp-slug still wins; notes keep timestamp slugs). A Micropub update
that adds or removes a title answers 201 with the new Location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:27:31 -07:00

52 lines
2.3 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 %}
{% from "partials/responses.html" import list_counts %}
{% macro note_preview(note, author) %}
<article class="h-entry note-preview">
{# Titled notes are articles (ADR-076) #}
{% if note.title %}
<h2 class="p-name"><a href="{{ note.url }}">{{ 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) }}
{% if note.title %}
{# Articles: title, summary and a link through; images stay on the article page (v2.16.0).
The photos stay in the markup, unseen, so parsers read the same post type here as on the page. #}
{% for item in note.media or [] %}<data class="u-photo" value="{{ url_for('public.media_file', path=item.path) }}"></data>{% endfor %}
{% set summary = note.summary or note.excerpt %}
{% if summary.strip() %}
<div class="p-summary">
<p>{{ summary }}</p>
</div>
{% endif %}
<p class="read-more"><a href="{{ note.url }}">Read more →</a></p>
{% else %}
{{ display_media(note.media, note.excerpt|truncate(150)) }}
{# 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 u-uid" href="{{ note.url }}"><time class="dt-published" datetime="{{ note.created_at|iso_utc }}">{{ 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 %}
{{ list_counts(note.response_counts if note.response_counts is defined else None, note.url) }}
{% 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 %}