{{/* 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 }} {{/* 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 }} {{ with $image }} {{ end }} {{ with .Params.author }}{{ end }} {{ range first 1 (.GetTerms "categories") }}{{ end }} {{ with $image }}{{ 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 }} {{ 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" $.Site.Title "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 ---- */}} {{ $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 }} {{ $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 }} {{ 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 }} {{ with $image }} {{ end }} {{ with $image }}{{ 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 }} {{ partial "breadcrumbs-schema.html" . }} {{ partial "faq-schema.html" . }} {{ end }}