A member fills in a bio, links and a photo, ticks a box, and has a page at vienalatina.com/su-nombre. Until they tick it there is no page, and an unpublished profile 404s exactly like a name that was never a member. The routing was the dangerous part and it is not solved by a list. The original plan reserved Hugo's paths in the Caddyfile, which is wrong the first time the site grows one, and the failure is a member's page silently shadowing part of vienalatina.com. Instead Caddy forwards a request only when the path is a single segment, is not /comunidad, and Hugo has built nothing there — `not file` with try_files. The static site wins every collision because the filesystem answers the question, so the rule cannot drift. A member called "de" shadows nothing; their profile is merely unreachable, which is why such names are refused at sign-up: to protect the member, not the site. An unknown name 404s from the app and handle_response turns that into the site's own 404.html, so the public site keeps its error page and the app never needs a public-facing one. Both directives verified against Caddy's documentation source, since caddyserver.com is unreachable here. Links are the injection surface on a public page: anything whose scheme is not http or https is dropped, which is asserted against javascript:, data: and vbscript:, including a leading-space variant. They render with rel="nofollow noopener". The photo is public, which the existing upload code deliberately is not, so it gets its own route that serves a file only while a published profile points at it. Unpublishing takes the picture down with the page, and a private board image cannot be fetched through it — both tested. The page does not extend base.html: that is the members-area chrome, and rendering a public page inside it would put "Área privada" and a Salir button on something anybody can read. It repeats the brand colours instead of sharing them, because Hugo fingerprints its stylesheet — a deliberate duplicate, named as one, with the source of truth in a comment. Migration 3 adds the columns. 231 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
68 lines
2.4 KiB
HTML
68 lines
2.4 KiB
HTML
{# Chrome deliberately mirrors the public site's header and footer, so moving
|
|
between vienalatina.com and the members area does not feel like leaving. #}
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
<title>{% block title %}Comunidad{% endblock %} — Viena Latina</title>
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='board.css') }}">
|
|
<script src="{{ url_for('static', filename='board.js') }}" defer></script>
|
|
</head>
|
|
<body>
|
|
|
|
<header class="site-bar">
|
|
<div class="site-bar__inner">
|
|
<a class="site-bar__brand" href="/"><span class="site-bar__brand-text">Viena Latina</span></a>
|
|
{% if g.member %}
|
|
<div class="site-bar__account">
|
|
<span class="who">{{ g.member.display_name }}</span>
|
|
<form method="post" action="{{ url_for('auth.logout') }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="linkish" type="submit">Salir</button>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if g.member %}
|
|
<nav class="site-bar__pages" aria-label="Secciones">
|
|
<ul class="page-nav">
|
|
<li><a href="{{ url_for('board.threads') }}">Mensajes</a></li>
|
|
{% if g.member.role in ('owner', 'admin') %}
|
|
<li>
|
|
{# "Mensajes" is the public board, so this cannot be called that.
|
|
The badge is only drawn when there is something to see. #}
|
|
<a href="{{ url_for('messages.inbox') }}">Privados{% set pending = unread_private() %}{% if pending %} <span class="tag">{{ pending }}</span>{% endif %}</a>
|
|
</li>
|
|
<li><a href="{{ url_for('profiles.edit') }}">Mi perfil</a></li>
|
|
<li><a href="{{ url_for('content.index') }}">Contenido</a></li>
|
|
{% endif %}
|
|
<li><a href="{{ url_for('members.index') }}">Miembros</a></li>
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
</header>
|
|
|
|
<div class="page-shell">
|
|
<main class="feed">
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% for category, message in messages %}
|
|
<p class="flash flash--{{ category }}">{{ message }}</p>
|
|
{% endfor %}
|
|
{% endwith %}
|
|
|
|
{% block main %}{% endblock %}
|
|
</main>
|
|
|
|
<footer class="site-foot">
|
|
<a href="/">Ir al sitio público</a>
|
|
{% if g.member %} · <a href="{{ url_for('members.export') }}">Descargar mis datos</a>{% endif %}
|
|
<div class="site-foot__legal">Viena Latina © {{ current_year }} · Área privada</div>
|
|
</footer>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|