**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
175 lines
7.8 KiB
HTML
175 lines
7.8 KiB
HTML
{{/* GEO/SEO surfaces — ported from theme/inc/seo.php:
|
|
hreflang alternates, Open Graph + og:locale(:alternate), Twitter Card,
|
|
JSON-LD BlogPosting (articles) / Blog (home), all with inLanguage. */}}
|
|
{{ $localeMap := .Site.Params.localeMap }}
|
|
{{ $locale := index $localeMap .Language.Lang | default "es_ES" }}
|
|
{{ $desc := "" }}
|
|
{{ if .IsPage }}{{ $desc = .Description | default (.Summary | plainify | truncate 200) }}{{ else }}{{ $desc = .Site.Params.description }}{{ end }}
|
|
{{/* One line, always. A summary pulled out of the body arrives with the line
|
|
breaks the prose had, and a newline inside og:description is a card that
|
|
renders raggedly in some readers and truncated in others. */}}
|
|
{{ $desc = trim ($desc | plainify | replaceRE "\\s+" " ") " " }}
|
|
|
|
{{/* The picture a share card shows. A page's own image when it has one, the
|
|
site default when it does not — `params.defaultImage` is empty until the
|
|
logo arrives, and a card with no picture is what happens meanwhile, which is
|
|
also what happens today. Absolute, because WhatsApp, Signal, Mastodon and
|
|
Bluesky all fetch it from outside and a relative path means nothing to
|
|
them. */}}
|
|
{{ $image := "" }}
|
|
{{ with .Params.image }}{{ $image = . | absURL }}
|
|
{{ else }}{{ with .Site.Params.defaultImage }}{{ $image = . | absURL }}{{ end }}{{ end }}
|
|
|
|
<meta name="description" content="{{ $desc }}">
|
|
|
|
{{/* hreflang — one alternate per language sibling + x-default to Spanish */}}
|
|
{{ if .IsTranslated }}
|
|
{{ range .AllTranslations }}
|
|
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}">
|
|
{{ end }}
|
|
{{ range .AllTranslations }}{{ if eq .Language.Lang "es" }}
|
|
<link rel="alternate" hreflang="x-default" href="{{ .Permalink }}">
|
|
{{ end }}{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if and .IsPage (eq .Section "post") }}
|
|
{{/* ---- Article ---- */}}
|
|
<meta property="og:type" content="article">
|
|
<meta property="og:site_name" content="{{ .Site.Title }}">
|
|
<meta property="og:title" content="{{ .Title }}">
|
|
<meta property="og:description" content="{{ $desc }}">
|
|
<meta property="og:url" content="{{ .Permalink }}">
|
|
<meta property="og:locale" content="{{ $locale }}">
|
|
{{ range .Translations }}
|
|
{{ with index $localeMap .Language.Lang }}<meta property="og:locale:alternate" content="{{ . }}">{{ end }}
|
|
{{ end }}
|
|
{{ with $image }}
|
|
<meta property="og:image" content="{{ . }}">
|
|
<meta property="og:image:alt" content="{{ $.Params.image_alt | default $.Title }}">
|
|
{{ end }}
|
|
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" }}">
|
|
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}">
|
|
{{ with .Params.author }}<meta property="article:author" content="{{ . }}">{{ end }}
|
|
{{ range first 1 (.GetTerms "categories") }}<meta property="article:section" content="{{ .LinkTitle }}">{{ end }}
|
|
|
|
<meta name="twitter:card" content="{{ if $image }}summary_large_image{{ else }}summary{{ end }}">
|
|
<meta name="twitter:title" content="{{ .Title }}">
|
|
<meta name="twitter:description" content="{{ $desc }}">
|
|
{{ with $image }}<meta name="twitter:image" content="{{ . }}">{{ end }}
|
|
|
|
{{ $schema := dict
|
|
"@context" "https://schema.org"
|
|
"@type" "BlogPosting"
|
|
"inLanguage" .Site.Language.LanguageCode
|
|
"headline" .Title
|
|
"description" $desc
|
|
"url" .Permalink
|
|
"datePublished" (.Date.Format "2006-01-02T15:04:05-07:00")
|
|
"dateModified" (.Lastmod.Format "2006-01-02T15:04:05-07:00")
|
|
"author" (dict "@type" "Person" "name" (.Params.author | default .Site.Title))
|
|
"publisher" (dict "@type" "Organization" "name" .Site.Title "url" .Site.Home.Permalink)
|
|
"mainEntityOfPage" (dict "@type" "WebPage" "@id" .Permalink)
|
|
}}
|
|
{{/* The author's own page, when they have published one. An answer engine
|
|
citing this article can then say who wrote it and point somewhere real —
|
|
which is the whole reason the byline carries a URL. */}}
|
|
{{ with .Params.author_url }}
|
|
{{ $schema = merge $schema (dict "author" (dict
|
|
"@type" "Person"
|
|
"name" ($.Params.author | default $.Site.Title)
|
|
"url" (. | absURL))) }}
|
|
{{ end }}
|
|
{{ with $image }}{{ $schema = merge $schema (dict "image" .) }}{{ end }}
|
|
<script type="application/ld+json">{{ $schema | jsonify (dict "indent" " ") | safeJS }}</script>
|
|
|
|
{{ partial "breadcrumbs-schema.html" . }}
|
|
{{ partial "faq-schema.html" . }}
|
|
|
|
{{ else if .IsHome }}
|
|
{{/* ---- Home ---- */}}
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:site_name" content="{{ .Site.Title }}">
|
|
<meta property="og:title" content="{{ .Site.Title }}">
|
|
<meta property="og:description" content="{{ $desc }}">
|
|
<meta property="og:url" content="{{ .Permalink }}">
|
|
<meta property="og:locale" content="{{ $locale }}">
|
|
|
|
{{ $org := dict
|
|
"@context" "https://schema.org"
|
|
"@type" "Organization"
|
|
"name" .Site.Title
|
|
"url" .Site.Home.Permalink
|
|
"description" .Site.Params.description
|
|
"areaServed" (dict "@type" "City" "name" "Wien" "addressCountry" "AT")
|
|
}}
|
|
{{ with .Site.Params.defaultImage }}{{ $org = merge $org (dict "logo" (. | absURL)) }}{{ end }}
|
|
{{ with .Site.Params.sameAs }}{{ $org = merge $org (dict "sameAs" .) }}{{ end }}
|
|
<script type="application/ld+json">{{ $org | jsonify (dict "indent" " ") | safeJS }}</script>
|
|
|
|
{{ $posts := first 10 (where .Site.RegularPages "Section" "post") }}
|
|
{{ $blogPost := slice }}
|
|
{{ range $posts }}
|
|
{{ $entry := dict
|
|
"@type" "BlogPosting"
|
|
"headline" .Title
|
|
"url" .Permalink
|
|
"datePublished" (.Date.Format "2006-01-02T15:04:05-07:00")
|
|
"author" (dict "@type" "Person" "name" (.Params.author | default .Site.Title))
|
|
}}
|
|
{{ with .Description }}{{ $entry = merge $entry (dict "description" .) }}{{ end }}
|
|
{{ $blogPost = $blogPost | append $entry }}
|
|
{{ end }}
|
|
{{ $schema := dict
|
|
"@context" "https://schema.org"
|
|
"@type" "Blog"
|
|
"name" .Site.Title
|
|
"description" $desc
|
|
"url" .Permalink
|
|
"inLanguage" .Site.Language.LanguageCode
|
|
}}
|
|
{{ if $blogPost }}{{ $schema = merge $schema (dict "blogPost" $blogPost) }}{{ end }}
|
|
<script type="application/ld+json">{{ $schema | jsonify (dict "indent" " ") | safeJS }}</script>
|
|
|
|
{{ else if .IsPage }}
|
|
{{/* ---- A static page: Acerca de, Contacto, their subpages ----
|
|
This branch did not exist, so a page shared as a bare link — no title card,
|
|
no picture, nothing for an answer engine to read beyond the prose. It is a
|
|
document about the organisation rather than an article, hence WebPage
|
|
rather than BlogPosting, and no author: a page is the site speaking. */}}
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:site_name" content="{{ .Site.Title }}">
|
|
<meta property="og:title" content="{{ .Title }}">
|
|
<meta property="og:description" content="{{ $desc }}">
|
|
<meta property="og:url" content="{{ .Permalink }}">
|
|
<meta property="og:locale" content="{{ $locale }}">
|
|
{{ range .Translations }}
|
|
{{ with index $localeMap .Language.Lang }}<meta property="og:locale:alternate" content="{{ . }}">{{ end }}
|
|
{{ end }}
|
|
{{ with $image }}
|
|
<meta property="og:image" content="{{ . }}">
|
|
<meta property="og:image:alt" content="{{ $.Params.image_alt | default $.Title }}">
|
|
{{ end }}
|
|
|
|
<meta name="twitter:card" content="{{ if $image }}summary_large_image{{ else }}summary{{ end }}">
|
|
<meta name="twitter:title" content="{{ .Title }}">
|
|
<meta name="twitter:description" content="{{ $desc }}">
|
|
{{ with $image }}<meta name="twitter:image" content="{{ . }}">{{ end }}
|
|
|
|
{{ $schema := dict
|
|
"@context" "https://schema.org"
|
|
"@type" "WebPage"
|
|
"inLanguage" .Site.Language.LanguageCode
|
|
"name" .Title
|
|
"description" $desc
|
|
"url" .Permalink
|
|
"dateModified" (.Lastmod.Format "2006-01-02T15:04:05-07:00")
|
|
"isPartOf" (dict "@type" "WebSite" "name" .Site.Title "url" .Site.Home.Permalink)
|
|
"publisher" (dict "@type" "Organization" "name" .Site.Title "url" .Site.Home.Permalink)
|
|
}}
|
|
{{ with $image }}{{ $schema = merge $schema (dict "image" .) }}{{ end }}
|
|
<script type="application/ld+json">{{ $schema | jsonify (dict "indent" " ") | safeJS }}</script>
|
|
|
|
{{ partial "breadcrumbs-schema.html" . }}
|
|
{{ partial "faq-schema.html" . }}
|
|
{{ end }}
|