**A signed-in member sees the members area from anywhere.** A slim bar above the
public header, with the same five sections /comunidad/ has. Those pages are
files on disk and get cached, so it is drawn in the browser: memberbar.js asks
/comunidad/sesion.json who is reading, and that endpoint is the only thing that
decides — a visitor is told `{"signed_in": false}` and the answer is never
cached. Sign-in also sets vl_sesion=1, a cookie holding one digit that scripts
can read, and without it the script makes no request at all: a stranger reading
one article costs the app nothing. It is a hint, never a credential — the
session cookie stays HttpOnly and signed, and a forged hint earns a reply saying
you are not signed in. Comunidad is now in the public menu in all three
languages, signed in or not.
**The public menu is built from the pages.** It was three names per language in
config.yaml, so a page published through Contenido never appeared on the site at
all and the German and Portuguese menus had to be kept in step by hand. Pages
carry `parent` (another page's basename — the one translate.py already uses to
pair siblings, so it holds in all three languages) and `weight`, both chosen in
the editor, and header.html builds two levels from them. URLs do not change: a
subpage is still /page/<slug>/, only the menu nests, so nothing in the Caddyfile
or the pipeline learns about folders. The dropdown is the theme's own, ported
from WordPress — hover, focus-within, inline on a phone, no script. A parent that
has been deleted is kept and labelled rather than silently dropped on the next
save.
**Sharing and the rest of SEO/GEO.** The groundwork was already here — hreflang,
Open Graph, Twitter card, BlogPosting, llms.txt, robots.txt naming the AI
crawlers — so this closes the gaps. Static pages had *none* of it and shared as
bare links; they now carry WebPage schema and the full set of tags. Both branches
gain og:image with an alt and a twitter:image, falling back to params.defaultImage
(empty until there is a logo, which is the one line to fill in then). The home
page gains Organization with areaServed Wien and a sameAs list; posts and pages
gain BreadcrumbList, and an article's structured data now carries the author's
profile URL. An optional FAQ — `pregunta|respuesta` per line — renders at the
foot of the page and as FAQPage schema, because current guidance for generative
engines puts exactly that shape at the top of what gets quoted, and schema
describing something invisible is what search engines penalise. translate.py
carries both new fields: image_alt joins the translated keys, and faq is
translated half by half so the separator survives.
**The writing boxes.** A markdown toolbar and a Vista previa on every box where
somebody writes prose, opted in with data-markdown. The preview POSTs to
/comunidad/previsualizar and renders with render.to_html — the same function the
board and the site use, so it cannot promise something publishing will not
deliver; a markdown parser in the browser would be a second opinion about what
somebody's text means. Choosing a picture now shows a thumbnail with its name and
size before anything is uploaded, which is the only reason `blob:` joins img-src:
a handle to bytes already in the page, reaching no network.
All of it ours, no dependency added, under a policy that loads scripts from this
origin only. Verified by building the site with Hugo 0.135, the version the
pipeline runs: the nested menu, the page's share tags, the FAQ schema matching
the rendered section, and llms.txt listing the pages.
463 tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
|
||
|---|---|---|
| apps/board | ||
| content | ||
| docker | ||
| docs | ||
| infra | ||
| scripts | ||
| static | ||
| themes/vienalatina | ||
| .gitignore | ||
| .woodpecker.yml | ||
| config.yaml | ||
| README.md | ||
Viena Latina
Self-hosted, trilingual site for the Latin American community in Vienna — Hugo + Decap CMS + Gitea + Woodpecker CI on a single Hetzner CX22 (Falkenstein, DE). Replaces the previous WordPress + Polylang + synchronous DeepL stack.
Translation is self-hosted too: OPUS-MT (CC-BY-4.0) runs on CPU via CTranslate2 in the pipeline image, with the models mounted from the host. No API key, no quota, and no visitor or content data leaving the server.
Pablo ──► Decap CMS (/admin) ──commit──► Gitea ──webhook──► Woodpecker CI
▲ │
│ translate ──────┤
OAuth2 build (hugo) ─┤
│ deploy (rsync) ─┘
│ ▼
Members ──► /comunidad/ ────────────────┘ Caddy 2 serves /var/www/vienalatina.com
Flask + SQLite …and proxies /comunidad/ to Flask
Everything except /comunidad/ is a static file built from git. The members
area is the one component that runs code to answer a request, and the one whose
data is not reproducible from the repository — see Members area below.
Languages
Spanish, German (/de/) and Brazilian Portuguese (/pt-br/). Any of the
three can be the authored original; the other two are generated by CI as
reviewable git commits. Siblings pair by filename basename:
content/post/mi-articulo.es.md ← authored (no `translated_from`)
content/post/mi-articulo.de.md ← written by scripts/translate.py
content/post/mi-articulo.pt-br.md ← written by scripts/translate.py
A generated file carries translated_from, which is what stops CI translating
its own output back into a loop. Machine output is never treated as a source.
manual_translation: true means "hands off", on both sides:
- on an authored original — don't generate siblings for this post at all
- on a generated sibling — never overwrite it again
Frontmatter contract
---
title: "Mi artículo"
date: 2026-07-31
lang: es
manual_translation: false
categories: [Gastronomía] # taxonomy terms stay Spanish in every language
---
Generated siblings additionally carry translated_from: es.
Translation flow
- Publish in Decap → one git commit.
- Gitea webhook fires Woodpecker.
scripts/translate.pydiffs the push, finds changed authored files in any language, generates the missing siblings, and pushes them back as a bot commit (translations@vienalatina.com) marked[skip-translate].hugo --minifybuilds,rsync --deletedeploys, Caddy serves.
Markup never reaches the model: code blocks and raw HTML pass through
untouched, and link targets, inline code and protected community terms
(Grätzl, Naschmarkt, …) are masked and verified to survive the round trip.
Small models drop those masks occasionally, so a failed round trip degrades in steps rather than failing the publish:
- mask markup and protected terms — the normal path;
- if a term is lost, retry guarding only markup, and log that the term may now be translated;
- if markup itself is lost, leave that segment in the source language and warn.
A stray ⦅0⦆ or a mangled URL therefore never reaches a reader, and one
awkward proper noun never blocks a deploy.
Backfill anything missing siblings (after the WP migration, or for pages that predate the pipeline):
python scripts/translate.py --backfill
Translation engine
Built once on the server, and again only when changing models:
docker build -t vienalatina/translate:1 docker/translate
The image bakes in a pre-converted CTranslate2 build of M2M100 418M plus its
tokenizer, so a publish makes no network calls. Tunable via MT_MODEL_DIR,
MT_TOKENIZER, MT_COMPUTE_TYPE and MT_THREADS.
Swapping engines means writing one class against
scripts/translation/provider.py — nothing in the pipeline changes. Two
upgrades worth knowing about:
- M2M100 1.2B — same MIT licence and same code path, materially better output, but ~2–2.5GB peak RAM. Needs an 8GB box (Hetzner CX32), not the CX22.
- opus-mt-tc-big — better still for these specific language pairs and the
only permissive option that handles Brazilian Portuguese distinctly (
>>pob<<), at the cost of CC-BY-4.0 attribution and one model per directed pair.
Do not build on NLLB-200 (CC-BY-NC, non-commercial) or LibreTranslate (AGPL-3.0) if this stack is ever to be sold or offered as a service.
Server setup
Full command-by-command walkthrough: docs/server-setup.md. The Caddyfile and Docker Compose files it uses live in infra/.
Local development
hugo server # http://localhost:1313
CI secrets (Woodpecker → repo settings → secrets)
| Secret | Value |
|---|---|
gitea_push_token |
Gitea token for the translations bot user, repo write access |
Translation needs no secret — the model is local.
The repo must be marked trusted in Woodpecker so the deploy step can
mount /var/www/vienalatina.com.
Decap CMS
static/admin/config.yml uses the Gitea backend. Register an OAuth app in
Gitea admin (redirect URI https://vienalatina.com/admin/) and put its
client ID in app_id. The Decap JS bundle is downloaded at build time into
static/admin/decap-cms.js (gitignored) — zero third-party requests at
runtime.
Members area
apps/board/ — a small Flask app at /comunidad/, behind Caddy. A member signs
in once and gets five sections: Inicio (a dashboard), Muro (the internal
board), Privados (messages between two members), Publicaciones (the
public site, through moderation) and, for admins, Gestión.
apps/board/
app.py factory, config, the CSRF and noindex hooks
auth.py the login form, passwords, the membership gate
passwords.py scrypt hashing and the failed-attempt limiter
members.py roles, onboarding, ownership transfer, GDPR erasure/export
home.py Inicio, and Gestión
board.py the wall: threads and comments
messages.py private messages, unread marks, blocking
submissions.py what members propose for the public site, and its moderation
content.py the editor — commits posts and pages through Gitea's API
profiles.py public pages at vienalatina.com/<name>
uploads.py pictures: sniffed, renamed, served behind the login
invites.py one-time links for invitations and password resets
gitea.py the only module that talks to Gitea
migrations.py numbered schema steps, keyed on PRAGMA user_version
render.py markdown with raw HTML disabled
schema.sql the tables, including the one-owner index
tests/ pytest — `python3 -m pytest apps/board/tests`
Four things about it are load-bearing and easy to undo by accident:
- The members area owns its own logins. A password is a scrypt hash in
members.password_hash; a NULL hash cannot be signed in with, which is what makes an invitation the only way in for a new member. - One owner, enforced by a partial unique index, not by application code. The owner cannot be suspended or demoted by anyone; stepping down means transferring ownership to an admin.
- A moderator curates content and has no power over people. No creating,
suspending, promoting or erasing anybody —
may_createandmay_manageinmembers.pyare the whole rule, and they are tested as plain functions. html=Falseinrender.pyis the entire XSS defence, and it works because markdown-it then emits only its own tags. Turning it on means owning a sanitiser allowlist forever.
Admins can delete anyone's post; nobody can edit anyone else's, admins included. Removing a post is visible to its author, quietly rewriting it is not. The same line runs through moderation: a moderator approves or returns a proposal, and never rewrites it to publish under somebody else's name.
The wall carries one 👍 per member per post or comment, every name links to that person's page when they have published one, and Miembros is a directory of cards rather than an admin table — the controls are there, folded into each card for admins.
Its SQLite database is the only state on the server that git does not hold.
scripts/backup-board.sh takes a consistent snapshot nightly — see
docs/server-setup.md §11.
Writing posts
/comunidad/contenido/ replaces Decap CMS: a form that commits a file through
Gitea's contents API, so Woodpecker sees an ordinary push and translate → build →
deploy runs unchanged. Commits name the person who wrote the post, not a bot —
write_file sends an author per commit.
Moderators and admins write there directly. A member writes in
/comunidad/publicaciones/ instead, and the proposal waits in SQLite until a
moderator approves it, which commits it through that same code under the
member's own name. Nothing a member writes reaches the repository before then,
because a commit to it is publication: the webhook starts the pipeline.
It exists because Decap has no supported way to be themed — its maintainer's
answer is override its CSS and accept that class names move, or fork it — so
/admin/ would always look like a different product bolted on.
Decap is still running. Both editors write the same files, and the pipeline
cannot tell them apart, so there is no cutover to get wrong. docs/server-setup.md
§11.8 covers removing Decap when the new editor has earned it.
Filenames are the contract, not a detail: YYYY-MM-DD-slug.es.md is what
split_lang() parses and what keeps two posts off one URL. The tests import
scripts/translate.py and run its parser over what the editor writes, because
a file it cannot parse publishes in Spanish and is never translated, silently.
GEO/SEO surfaces
hreflang+og:locale(:alternate)+ JSON-LDBlogPosting/BlogwithinLanguage—themes/vienalatina/layouts/partials/seo-head.htmlrobots.txtAI-crawler allowlist —static/robots.txtllms.txt— generated at build time fromlayouts/index.llms.txtsitemap.xml— Hugo native, multilingual
One-shot content migration
pip install requests html2text
python scripts/wp-to-hugo.py https://<old-wp-site>
Converts every WP post (with Polylang siblings) to
content/post/<slug>.<lang>.md, downloads images into static/uploads/,
and preserves existing slugs. Spot-check ~10 articles before committing.
Add Caddy 301s for WP URL patterns that don't map cleanly
(?p=123, /categoria/... → /categories/...).