Half of this already existed and nothing said so. `threads.pinned` has
been in the schema since the board shipped, with an index on it and a
toggle route, but it was @admin_required, reachable only from inside a
thread, and Inicio ignored it.
Who. Moderators and above, on both halves. Curating what the public
reads is the whole of a moderator's job, and content.py has said so
since the queue was built. Locking a thread rides the same route and is
still an admin's: it stops named people saying anything more to each
other, which is power over people rather than over content, and this
codebase keeps those apart everywhere else.
What is stored. A moment, not a flag — several posts can be pinned and
the newest pin goes first, so the value is the order. `pinned:
'2026-10-13T12:00:00'` in a post's own frontmatter, written only when
true; `threads.pinned_at` beside the flag the wall already had, cleared
on unpinning so that pinning again puts it where a new pin belongs. One
key carrying both means `{{ if .Params.pinned }}` still reads as a
yes/no and nothing has to be kept in step with anything.
translate.py needs nothing: it copies the whole frontmatter and rewrites
only TRANSLATED_KEYS, so a pinned post is pinned in German too. Asserted
against the real list rather than assumed.
Two ways to pin a public post — the switch beside Publicar, and one
press in the Contenido list, because deciding what the site leads with
means looking at the list rather than opening each post to find out what
is in it. Both commit; the file is the record.
Migration 10 adds the columns and recreates the wall's index, which now
names pinned_at. `CREATE INDEX IF NOT EXISTS` leaves an existing index
exactly as it is, so without that a running server keeps the old
definition forever while a fresh install gets the new one. Nothing
breaks either way, which is the problem.
Checked rather than assumed: built with Hugo 0.135.0 and the pipeline's
flags, two pinned posts come out above a newer unpinned one and in
pin order rather than post order, with the pill on the cards and on the
article. And the wall rendered at 390px, where the pinned thread leads
and nothing overflows.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
49 lines
1.8 KiB
HTML
49 lines
1.8 KiB
HTML
{% extends "base.html" %}
|
|
{% from "_person.html" import person %}
|
|
{% from "_reaction.html" import reaction %}
|
|
{% from "_pin.html" import pin %}
|
|
{% block title %}Muro{% endblock %}
|
|
|
|
{% block main %}
|
|
<div class="feed-head">
|
|
<h1>Muro</h1>
|
|
<a class="btn" href="{{ url_for('board.new_thread') }}">Escribir</a>
|
|
</div>
|
|
|
|
{% if not threads %}
|
|
<article class="card">
|
|
<p class="muted">Todavía no hay nada en el muro. Escribe el primero.</p>
|
|
</article>
|
|
{% endif %}
|
|
|
|
{% for t in threads %}
|
|
<article class="card">
|
|
<div class="card__meta">
|
|
{% if t.pinned %}<span class="tag">Fijado</span>{% endif %}
|
|
{% if t.locked %}<span class="tag tag--quiet">Cerrado</span>{% endif %}
|
|
{% if t.ai_generated %}<span class="tag tag--ai" title="Quien lo publicó marcó este texto como generado con inteligencia artificial.">Generado con IA</span>{% endif %}
|
|
<span>{{ person(t.author, t.author_login) }}</span> · <time>{{ t.created_at }}</time>
|
|
</div>
|
|
<h2 class="card__title">
|
|
<a href="{{ url_for('board.thread', thread_id=t.id) }}">{{ t.title }}</a>
|
|
</h2>
|
|
<p class="card__excerpt">{{ excerpt(t.body_md) }}</p>
|
|
<div class="card__foot">
|
|
{{ reaction('thread', t.id, reactions.get(t.id), url_for('board.threads', page=page)) }}
|
|
<span>{{ t.replies }} respuesta{{ '' if t.replies == 1 else 's' }}</span>
|
|
{# From here as well as from the thread page: deciding what the wall
|
|
leads with means looking at the wall, not opening each thread to
|
|
find out what is on it. #}
|
|
{% if may_pin %}{{ pin(t, url_for('board.threads', page=page)) }}{% endif %}
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
|
|
{% if page > 1 or has_next %}
|
|
<nav class="pager">
|
|
{% if page > 1 %}<a href="{{ url_for('board.threads', page=page - 1) }}">← Anteriores</a>{% endif %}
|
|
{% if has_next %}<a href="{{ url_for('board.threads', page=page + 1) }}">Siguientes →</a>{% endif %}
|
|
</nav>
|
|
{% endif %}
|
|
{% endblock %}
|