{{/* 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. */}} {{/* The site's name, resolved once. Every JSON-LD block below used to read `.Site.Title` directly, which bypassed Gestión → Identidad entirely: rename the site there and every og: tag updated while every `publisher`, `author` and `isPartOf` kept the config.yaml name — the home page emitted two blocks that openly disagreed. Once, into a variable, because the call sites sit at four different nesting levels and `.` is not the page in all of them. */}} {{ $sitename := partial "site-name.html" . }} {{ $localeMap := .Site.Params.localeMap }} {{ $locale := index $localeMap .Language.Lang | default "es_ES" }} {{ $desc := "" }} {{ if .IsPage }}{{ $desc = .Description | default (.Summary | plainify | truncate 200) }}{{ else }}{{ $desc = partial "site-tagline.html" . }}{{ 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, and otherwise the fallback: the logo uploaded in Gestión → Marca, or `params.defaultImage` when there is no logo. The logo comes first because it is the one somebody can change without the repository — and because `defaultImage` only ever existed as the line to fill in once a logo arrived. With neither, a card shows title and description and no picture, which is what happened before either existed. Absolute, because WhatsApp, Signal, Mastodon and Bluesky all fetch it from outside and a relative path means nothing to them. */}} {{ $brandLogo := "" }}{{ $chosen := "" }} {{ with site.Data.brand }}{{ $brandLogo = .logo }}{{ end }} {{ with site.Data.site }}{{ $chosen = .share_image }}{{ end }} {{/* The picture chosen in Identidad wins over the logo, which wins over the one in config.yaml: most sites want their logo and the field exists for the ones that want something else. */}} {{ $fallback := or $chosen (or $brandLogo .Site.Params.defaultImage) }} {{/* The card is *generated*, not pointed at. What used to go out was the original upload — a photograph off a phone, two to five megabytes. WhatsApp fetches a preview image on a tight budget and gives up on a file that size, so the card arrived as a title and a link with a blank where the picture should be. That is the whole reason `static/uploads` is mounted into `assets/` in config.yaml: Hugo copies static files and processes asset files, and only one of those can be resized. A post's own photograph is filled to 1200×630 — the size every client draws its large card at — and comes out at 80–150 KB. The fallback is fitted rather than filled, because a wordmark cropped to a landscape card is a wordmark with its ends cut off. An image the pipeline cannot find — a path typed by hand, a file added after the build — falls back to exactly what happened before: the absolute URL, no dimensions. Nothing is worse than it was. */}} {{ $source := or .Params.image $fallback }} {{ $image := "" }}{{ $cardW := "" }}{{ $cardH := "" }}{{ $cardType := "" }} {{ with $source }} {{ $image = . | absURL }} {{ with resources.Get (strings.TrimPrefix "/" .) }} {{ $card := "" }} {{ if $.Params.image }} {{ $card = .Fill "1200x630 Center q82 jpg" }} {{ else }} {{/* Fitted, and in its own format: the fallback is usually the logo, and a logo cropped to a landscape card loses its ends — while converting a transparent PNG to JPEG puts it on a black square, because JPEG has no alpha to put it on anything else. */}} {{ $card = .Fit "1200x630" }} {{ end }} {{ $image = $card.Permalink }} {{ $cardW = $card.Width }}{{ $cardH = $card.Height }}{{ $cardType = $card.MediaType.Type }} {{ end }} {{ end }} {{ $cardAlt := cond (ne .Params.image_alt nil) .Params.image_alt .Title }} {{ $card := dict "url" $image "alt" $cardAlt "width" $cardW "height" $cardH "type" $cardType }} {{/* hreflang — one alternate per language sibling + x-default to Spanish */}} {{ if .IsTranslated }} {{ range .AllTranslations }} {{ end }} {{ range .AllTranslations }}{{ if eq .Language.Lang "es" }} {{ end }}{{ end }} {{ end }} {{ if and .IsPage (eq .Section "post") }} {{/* ---- Article ---- */}} {{ range .Translations }} {{ with index $localeMap .Language.Lang }}{{ end }} {{ end }} {{ partial "og-image.html" $card }} {{ with .Params.author }}{{ 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 $sitename)) "publisher" (dict "@type" "Organization" "name" $sitename "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 $sitename) "url" (. | absURL))) }} {{ end }} {{ with $image }}{{ $schema = merge $schema (dict "image" .) }}{{ end }} {{ partial "breadcrumbs-schema.html" . }} {{ partial "faq-schema.html" . }} {{/* An event is also an Event. This is what puts a date next to the result in a search listing, and what an answer engine reads when somebody asks what is on in Vienna this weekend — the article alone says none of it in a form a machine can use. */}} {{ with .Params.event_date }} {{ $when := . | time.AsTime }} {{ $start := $when.Format "2006-01-02" }} {{ with $.Params.event_time }}{{ $start = printf "%sT%s:00" $start . }}{{ end }} {{ $event := dict "@context" "https://schema.org" "@type" "Event" "name" $.Title "startDate" $start "url" $.Permalink "inLanguage" $.Site.Language.LanguageCode "eventAttendanceMode" "https://schema.org/OfflineEventAttendanceMode" "eventStatus" "https://schema.org/EventScheduled" "organizer" (dict "@type" "Organization" "name" $sitename "url" $.Site.Home.Permalink) }} {{ with $desc }}{{ $event = merge $event (dict "description" .) }}{{ end }} {{ with $image }}{{ $event = merge $event (dict "image" .) }}{{ end }} {{ with $.Params.event_location }} {{ $event = merge $event (dict "location" (dict "@type" "Place" "name" . "address" (dict "@type" "PostalAddress" "addressLocality" "Wien" "addressCountry" "AT"))) }} {{ end }} {{ end }} {{ else if .IsHome }} {{/* ---- Home ---- */}} {{/* The home page shared without a picture until there was one to use. Now that an admin can upload a logo, the front page of the site is the last place that should share as a bare link. */}} {{ partial "og-image.html" (merge $card (dict "alt" (partial "site-name.html" .))) }} {{/* The organisation, as a search or answer engine reads it. Everything overridable lives in Gestión → Identidad; `areaServed` stays here because a city is a fact about this association and not a setting. */}} {{ $org := dict "@context" "https://schema.org" "@type" "Organization" "name" (partial "site-name.html" .) "url" .Site.Home.Permalink "description" (partial "site-tagline.html" .) "areaServed" (dict "@type" "City" "name" "Wien" "addressCountry" "AT") }} {{ with site.Data.site }} {{/* sameAs is how an engine knows an Instagram account and this site are one body — the single highest-value field here for being found at all. */}} {{ with .sameAs }}{{ $org = merge $org (dict "sameAs" .) }}{{ end }} {{ with .email }} {{ $org = merge $org (dict "contactPoint" (dict "@type" "ContactPoint" "contactType" "general" "email" .)) }} {{ end }} {{ if or .city .street }} {{ $address := dict "@type" "PostalAddress" "addressCountry" "AT" }} {{ with .city }}{{ $address = merge $address (dict "addressLocality" .) }}{{ end }} {{ with .street }}{{ $address = merge $address (dict "streetAddress" .) }}{{ end }} {{ with .phone }}{{ $org = merge $org (dict "telephone" .) }}{{ end }} {{ $org = merge $org (dict "address" $address) }} {{ end }} {{ end }} {{/* The same fallback as the share card: the admin's logo, then the configured default. This is the field a search engine uses to put a mark beside the organisation's name, so it should be the logo somebody actually uploaded. */}} {{ with $fallback }}{{ $org = merge $org (dict "logo" (. | absURL)) }}{{ end }} {{ with .Site.Params.sameAs }}{{ $org = merge $org (dict "sameAs" .) }}{{ end }} {{ $posts := first 10 (partial "posts-ordered.html" (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 $sitename)) }} {{ with .Description }}{{ $entry = merge $entry (dict "description" .) }}{{ end }} {{ $blogPost = $blogPost | append $entry }} {{ end }} {{ $schema := dict "@context" "https://schema.org" "@type" "Blog" "name" $sitename "description" $desc "url" .Permalink "inLanguage" .Site.Language.LanguageCode }} {{ if $blogPost }}{{ $schema = merge $schema (dict "blogPost" $blogPost) }}{{ end }} {{ 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. */}} {{ range .Translations }} {{ with index $localeMap .Language.Lang }}{{ end }} {{ end }} {{ partial "og-image.html" $card }} {{ $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" $sitename "url" .Site.Home.Permalink) "publisher" (dict "@type" "Organization" "name" $sitename "url" .Site.Home.Permalink) }} {{ with $image }}{{ $schema = merge $schema (dict "image" .) }}{{ end }} {{ partial "breadcrumbs-schema.html" . }} {{ partial "faq-schema.html" . }} {{ end }}