{{/* 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 }}
{{/* 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 .Params.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)
}}
{{ with .Params.image }}{{ $schema = merge $schema (dict "image" (. | absURL)) }}{{ end }}
{{ else if .IsHome }}
{{/* ---- Home ---- */}}
{{ $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 }}
{{ end }}