{{- /* head-seo.html — , meta description, canonical, Open Graph, Twitter, RSS alternate, and JSON-LD (delegated to schema-jsonld.html). All values fall back sensibly to brand data. */ -}} {{- $brand := .Site.Data.brand -}} {{- $pageTitle := .Params.seoTitle | default .Params.title | default .Title -}} {{- $title := $pageTitle -}} {{- if and (not .IsHome) (not (in (lower $pageTitle) (lower $brand.name))) -}} {{- $title = printf "%s | %s" $pageTitle $brand.name -}} {{- end -}} {{- $desc := "" -}} {{- with .Params.description -}} {{- $desc = . -}} {{- else -}} {{- $desc = .Summary | default .Site.Params.defaultDescription -}} {{- end -}} {{- $desc = $desc | plainify | chomp | truncate 160 -}} {{- /* Per-page OG image override (.Params.image) with fallback to the site default. */ -}} {{- $imagePath := .Params.image | default .Site.Params.ogImage -}} {{- $ogImage := cond (ne $imagePath "") ($imagePath | absURL) "" -}} {{- $ogImageAlt := .Params.imageAlt | default (printf "%s - %s" $brand.name $pageTitle) -}} {{- $ogLocale := $brand.defaultLocale | default .Language.LanguageCode | default .Language.Lang -}} {{- range $brand.supportedLocales -}} {{- if or (eq . $.Language.LanguageCode) (hasPrefix . (printf "%s-" $.Language.Lang)) -}}{{- $ogLocale = . -}}{{- end -}} {{- end -}} {{- $isPlaceholderHost := or (in (lower .Site.BaseURL) "example.com") (in (lower .Site.BaseURL) ".example") -}} {{- $noindex := or .Params.noindex $isPlaceholderHost (eq .Kind "404") -}} {{- $schemaType := .Params.schemaType | default "none" -}} {{- $isArticle := in (slice "Article" "Review") $schemaType -}} {{- $canonical := .Params.canonicalURL | default .Permalink -}} <title>{{ $title }} {{- if ne .Kind "404" }} {{- end }} {{- /* Open Graph */ -}} {{- with $ogImage }} {{- end }} {{- if and $isArticle (not .Date.IsZero) }} {{- end }} {{- if and $isArticle (not .Lastmod.IsZero) }} {{- end }} {{- /* Twitter */ -}} {{- with $ogImage }} {{- end }} {{- /* hreflang alternates for the multilingual build. No-op on single-language sites (.IsTranslated is false), so it is safe to keep permanently. URL scheme: defaultContentLanguageInSubdir = false (English at root). */ -}} {{- if .IsTranslated -}} {{- range .AllTranslations -}} {{- end -}} {{- /* x-default must point at the site's DEFAULT content language (English at root), independent of the page currently being rendered. site.Languages is ordered by weight, so index 0 is the default language. */ -}} {{- $defaultLang := (index site.Languages 0).Lang -}} {{- range .AllTranslations -}} {{- if eq .Language.Lang $defaultLang -}} {{- end -}} {{- end -}} {{- range .Translations -}} {{- end -}} {{- end }} {{ with .OutputFormats.Get "RSS" -}} {{- end }} {{ partial "schema-jsonld.html" . }}