Two different causes that look like one bug, and neither is fixed by
the other.
The site. The editor wrote `date: 2026-07-31` with no clock, so
everything published on one day was byte-identical in the field Hugo
sorts by — and Hugo fell through to its next key, the title. A day came
out alphabetised, permanently, because a rebuild changes nothing about
the files. None of the four post feeds applied an explicit sort either,
so all four inherited it.
`stamp()` attaches the clock, in `frontmatter_for`, which every
publishing path goes through. The day is still the one whoever publishes
chose and the URL still carries only the day, so nothing anyone linked
to moves. An edit keeps the time the file already had as long as the day
has not changed — a typo correction must not carry a year-old post to
the top of the page, which is what the hidden date_stamped field is for.
`partials/posts-ordered.html` is the other half: the order stated once
and called from the home page, the section list, llms.txt and the
BlogPosting block. `first N` goes on its result, never its input.
Both halves are needed, and I checked that rather than assuming it:
built with Hugo 0.135.0 and the pipeline's flags, two posts dated the
same day come out 11:00 before 09:00; with the clock removed and the
partial left in place, the alphabetically-first one is back on top.
The members area. Nothing had a tiebreak. `created_at` is
`datetime('now')` — one-second resolution — so two rows written in the
same second compared equal and SQLite was free to return them in either
order. Every ordering ends in the primary key now; activity.py had it
already and was the model.
Two disagreements went with it: Inicio's wall panel orders by `pinned`
like the wall, and its own-submissions panel uses the ranking
Publicaciones uses. The two moderation queues stay oldest-first on
purpose — a queue is not a feed.
And the public agenda sorts a day's events by the hour, which the
private calendar has done since it was written.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
172 lines
8.0 KiB
HTML
172 lines
8.0 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ 'Editar' if item else 'Nuevo' }} {{ meta.singular|lower }}{% endblock %}
|
|
|
|
{% set f = fields or {} %}
|
|
|
|
{% block main %}
|
|
{% if preview_html %}
|
|
<article class="card">
|
|
<div class="card__meta"><span class="tag tag--quiet">Vista previa</span></div>
|
|
<h1 class="card__title">{{ f.title }}</h1>
|
|
<div class="prose">{{ preview_html }}</div>
|
|
</article>
|
|
{% endif %}
|
|
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('content.edit', collection=collection, name=item.name) if item
|
|
else url_for('content.new', collection=collection) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
{% if item %}
|
|
<input type="hidden" name="sha" value="{{ item.sha }}">
|
|
<input type="hidden" name="name" value="{{ item.name }}">
|
|
{% endif %}
|
|
{# The byline travels with the document, like the date and the image path.
|
|
An edit keeps whoever wrote it; only publishing sets it. #}
|
|
{% if f and f.author %}
|
|
<input type="hidden" name="author" value="{{ f.author }}">
|
|
<input type="hidden" name="author_url" value="{{ f.author_url or '' }}">
|
|
{% endif %}
|
|
|
|
<h1>{{ ('Editar ' ~ meta.singular|lower) if item else meta.new_label }}</h1>
|
|
|
|
<label for="title">Título</label>
|
|
<input id="title" name="title" maxlength="140" value="{{ f.title or '' }}">
|
|
|
|
{% if meta.dated %}
|
|
<label for="date">Fecha</label>
|
|
<input id="date" name="date" type="date" required value="{{ f.date_input or today }}">
|
|
{#- The publication time the post already carries. Hugo sorts the blog by
|
|
the whole of it and a date field is only a day, so without this, saving
|
|
a corrected typo would restamp the clock and carry a year-old post to
|
|
the top of the home page. -#}
|
|
<input type="hidden" name="date_stamped" value="{{ f.date_stamped or '' }}">
|
|
{% endif %}
|
|
|
|
{% if collection == 'page' %}
|
|
{# Where this page sits in the public menu. The menu is built from the pages
|
|
themselves, so a page published here appears on the site by itself —
|
|
choosing a parent puts it in the submenu under that page instead of on the
|
|
top row. The choice is made once and holds in the three languages. #}
|
|
<label for="parent">En el menú</label>
|
|
{% set names = parents | map(attribute='base') | list %}
|
|
<select id="parent" name="parent">
|
|
<option value="">En la barra principal</option>
|
|
{% if f.parent and f.parent not in names %}
|
|
{# The page it hung under has been deleted, or the git server could not be
|
|
reached to list them. Either way the relationship is kept and said out
|
|
loud, rather than dropped silently by the next save. #}
|
|
<option value="{{ f.parent }}" selected>Dentro de «{{ f.parent }}» (no encontrada)</option>
|
|
{% endif %}
|
|
{% for other in parents %}
|
|
<option value="{{ other.base }}" {{ 'selected' if f.parent == other.base }}>
|
|
Dentro de «{{ other.title }}»
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
|
|
<label for="weight">Orden</label>
|
|
<input id="weight" name="weight" type="number" min="0" max="999"
|
|
value="{{ f.weight or 50 }}">
|
|
<p class="muted small">Menor número, más a la izquierda. 50 si da igual.</p>
|
|
{% endif %}
|
|
|
|
{% if collection == 'post' %}
|
|
{# An event's own date, which is not the day the post goes up. The date is
|
|
also what makes this post an event: there is nothing to tick first, so
|
|
there is no way to say "this is an event" and then not say when. #}
|
|
{#- A fold rather than a fieldset: most posts are not events, and six
|
|
inches of date pickers between the title and the text is six inches
|
|
most people scroll past. Open by itself when the post already has a
|
|
date, so editing an event does not hide the thing being edited. -#}
|
|
<details class="fold" {{ 'open' if f.event_date }}>
|
|
<summary>Si es un evento <span class="muted small">(fecha, hora, lugar)</span></summary>
|
|
<p class="muted small">
|
|
Pon la fecha y será un evento: aparecerá en la agenda del sitio, con el
|
|
día y el lugar destacados, y se podrá añadir al calendario del móvil.
|
|
Déjala vacía y es un artículo normal.
|
|
</p>
|
|
|
|
<label for="event_date">Fecha del evento</label>
|
|
<input id="event_date" name="event_date" type="date" value="{{ f.event_date or '' }}">
|
|
|
|
<label for="event_time">Hora <span class="muted small">(opcional)</span></label>
|
|
<input id="event_time" name="event_time" type="time" value="{{ f.event_time or '' }}">
|
|
<p class="muted small">Déjala vacía si dura todo el día.</p>
|
|
|
|
<label for="event_location">Lugar <span class="muted small">(opcional)</span></label>
|
|
<input id="event_location" name="event_location" maxlength="200"
|
|
value="{{ f.event_location or '' }}">
|
|
<p class="muted small">Dónde es: el sitio, la calle, el barrio.</p>
|
|
</details>
|
|
|
|
<label for="description">Resumen</label>
|
|
<textarea id="description" name="description" rows="2">{{ f.description or '' }}</textarea>
|
|
<p class="muted small">
|
|
Una o dos frases que se entiendan solas: es lo que aparece en los
|
|
listados, en WhatsApp al compartir el enlace y lo que citan los
|
|
buscadores. Mejor concreta («El sábado 12 en Ottakring») que general.
|
|
</p>
|
|
|
|
<label for="picture">Imagen destacada</label>
|
|
{% if f.image %}
|
|
<p class="muted small">Actual: <span class="mono">{{ f.image }}</span> — sube otra para reemplazarla.</p>
|
|
<input type="hidden" name="image" value="{{ f.image }}">
|
|
{% endif %}
|
|
<input id="picture" name="picture" type="file" accept="image/*">
|
|
|
|
<label for="image_alt">Texto alternativo de la imagen</label>
|
|
<input id="image_alt" name="image_alt" maxlength="200" value="{{ f.image_alt or '' }}">
|
|
<p class="muted small">
|
|
Qué se ve en la foto, en una frase. Lo lee quien no puede ver la imagen y
|
|
lo leen también los buscadores.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<label for="body">Cuerpo</label>
|
|
<textarea id="body" data-markdown data-rich="full" name="body" rows="18" required
|
|
placeholder="Markdown: **negrita**, ## títulos, listas, [enlaces](https://…).">{{ body }}</textarea>
|
|
{#- The stored markdown, rendered by the server for the editor to adopt.
|
|
There is no markdown parser in the browser: this is how the box can
|
|
show the formatting without a second opinion about what somebody's
|
|
text means. Ignored entirely when scripting is off. -#}
|
|
<template data-rich-html="body">{{ to_html(body, breaks=False) }}</template>
|
|
|
|
<label for="faq">Preguntas frecuentes <span class="muted small">(opcional)</span></label>
|
|
<textarea id="faq" name="faq" rows="5"
|
|
placeholder="¿Dónde es?|En la plaza de Ottakring, junto al mercado.">{{ f.faq or '' }}</textarea>
|
|
<p class="muted small">
|
|
Una por línea, con el formato <span class="mono">pregunta|respuesta</span>.
|
|
Se muestran al final de la página y son lo que mejor citan los buscadores
|
|
y los asistentes de IA: pregunta concreta, respuesta corta y verificable.
|
|
</p>
|
|
|
|
<label class="check">
|
|
<input type="checkbox" name="manual_translation" {{ 'checked' if f.manual_translation }}>
|
|
Traducción manual — no generar alemán ni portugués para esto
|
|
</label>
|
|
|
|
<div class="actions">
|
|
<button class="btn" type="submit">{{ 'Guardar' if item else 'Publicar' }}</button>
|
|
{#- Beside the button that publishes, because that is the moment it is
|
|
answered. One line rather than a fieldset: it has to be seen, not
|
|
to take up the form. -#}
|
|
<label class="toggle">
|
|
<input type="checkbox" name="ai_generated" {{ 'checked' if f.ai_generated }}>
|
|
{#- The switch itself is drawn by board.css from the checkbox's own
|
|
state. No script: a control that needs one is a control that
|
|
does nothing under this Content-Security-Policy. -#}
|
|
<span class="toggle__track" aria-hidden="true"></span>
|
|
<span class="toggle__text">Contenido generado con IA</span>
|
|
</label>
|
|
|
|
{#- Beside Cancelar and shaped like it: both are things you press in this
|
|
row, and a bare link wedged between two buttons reads as unfinished. -#}
|
|
<button class="btn btn--quiet" type="submit"
|
|
formaction="{{ url_for('content.preview', collection=collection) }}">
|
|
Vista previa
|
|
</button>
|
|
<a class="btn btn--quiet" href="{{ url_for('content.index', collection=collection) }}">Cancelar</a>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|