{{- /*
OpenGraph + Twitter Card meta - without it, a link shared on Mastodon,
Bluesky, Slack or X renders as a bare URL instead of a title/description/
image card. Takes a dict of `page` (the page being rendered), `desc`
(baseof.html's own text) and `image`
(page-image.html's own dict) so none of the three can drift apart by being
computed twice.
*/ -}}
{{- $page := .page }}
{{- $desc := .desc }}
{{- $title := cond $page.IsHome site.Title $page.Title }}
{{- $image := .image.url }}
{{- $imageWidth := .image.width }}
{{- $imageHeight := .image.height }}
{{- /* og:locale wants en_US, not the "en-us" languages.*.locale in hugo.toml. */}}
{{- $localeParts := split site.Language.Locale "-" }}
{{- $locale := site.Language.Locale }}
{{- if eq (len $localeParts) 2 }}
{{- $locale = printf "%s_%s" (index $localeParts 0) (upper (index $localeParts 1)) }}
{{- end }}
{{- with $desc }}
{{- end }}
{{- range $page.Translations }}
{{- $tParts := split .Language.Locale "-" }}
{{- $tLocale := .Language.Locale }}
{{- if eq (len $tParts) 2 }}
{{- $tLocale = printf "%s_%s" (index $tParts 0) (upper (index $tParts 1)) }}
{{- end }}
{{- end }}
{{- with $image }}
{{- with $imageWidth }}
{{- end }}
{{- with $imageHeight }}
{{- end }}
{{- else }}
{{- end }}
{{- with $desc }}
{{- end }}
{{- with site.Params.profile }}
{{- with (index (where .links "id" "linkTweetsTwitter") 0) }}
{{- end }}
{{- end }}
{{- if $page.IsPage }}
{{- if ne $page.Lastmod $page.Date }}
{{- end }}
{{- end }}