vienalatina/static/admin/config.yml
Claude 67706ee36e
Stop two posts with the same title from sharing one URL
Publishing a second "Hola mundo" through the CMS broke the first one's page:
it rendered the article, then a second copy of the entire site. Three silent
failures lined up.

Decap could not write hola-mundo.es.md twice, so it wrote hola-mundo.es-1.md.
That suffix is not a language, so Hugo stopped treating the file as a Spanish
sibling and translate.py's split_lang() skipped it — the post went live in
Spanish alone, and no German or Portuguese was ever generated. Meanwhile
permalinks used "/:slug/", and :slug falls back to the title, so both files
claimed /hola-mundo/; Hugo wrote both documents into that one index.html.
Nothing failed. The pipeline was green throughout.

Each layer now refuses its part: post permalinks carry the year and month, the
CMS prefixes new filenames with the date, and translate.py aborts on a name
ending in a clash counter rather than quietly declining to translate it. The
build also runs with --printPathWarnings --panicOnWarning, so any future pair
of pages targeting one path fails the build instead of corrupting the output.

Existing post URLs change shape (/hola-mundo/ becomes /2026/09/hola-mundo/).
That costs nothing today, with one real post and no inbound links, and gets
expensive to change later.

Verified: 16/16 pipeline checks and 15/15 markdown checks still pass, the
clash-counter name aborts with the rename instruction, and an ordinary
filename still parses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-09-22 07:49:46 +00:00

58 lines
2.4 KiB
YAML

# Decap CMS configuration — Gitea backend (OAuth app registered in Gitea admin).
backend:
name: gitea
repo: pablo/vienalatina # owner/repo inside Gitea
branch: main
base_url: https://git.vienalatina.com
api_root: https://git.vienalatina.com/api/v1
app_id: REPLACE_WITH_GITEA_OAUTH_CLIENT_ID
site_url: https://vienalatina.com
display_url: https://vienalatina.com
media_folder: static/uploads
public_folder: /uploads
# Pablo authors Spanish sources only; CI generates the .de.md / .pt-br.md siblings.
collections:
- name: post
label: "Artículos"
label_singular: "Artículo"
folder: content/post
create: true
extension: md
format: yaml-frontmatter
# Date-prefixed so a repeated title does not collide on the filename. When
# it does collide, Decap appends "-1" and writes `hola-mundo.es-1.md` — a
# name whose suffix is no longer `.es`, so Hugo stops seeing a Spanish
# sibling and translate.py's split_lang() skips the file entirely: the post
# publishes but is never translated, with nothing reported anywhere.
slug: "{{year}}-{{month}}-{{day}}-{{slug}}.es"
filter: { field: lang, value: es }
fields:
- { name: title, label: "Título", widget: string }
- { name: date, label: "Fecha", widget: datetime }
- { name: lang, label: "Idioma", widget: hidden, default: es }
- { name: manual_translation, label: "Traducción manual (congelar)", widget: boolean, default: false, required: false }
- { name: categories, label: "Categorías", widget: select, multiple: true,
options: ["Turismo", "Cultura", "Gastronomía", "Comunidad", "Comercio"] }
- { name: description, label: "Resumen", widget: text, required: false }
- { name: image, label: "Imagen destacada", widget: image, required: false }
- { name: body, label: "Cuerpo", widget: markdown }
- name: page
label: "Páginas"
label_singular: "Página"
folder: content/page
create: true
extension: md
format: yaml-frontmatter
slug: "{{slug}}.es"
filter: { field: lang, value: es }
fields:
- { name: title, label: "Título", widget: string }
- { name: date, label: "Fecha", widget: datetime, required: false }
- { name: lang, label: "Idioma", widget: hidden, default: es }
- { name: manual_translation, label: "Traducción manual (congelar)", widget: boolean, default: false, required: false }
- { name: body, label: "Cuerpo", widget: markdown }