2025-11-29 17:51:00 +01:00
|
|
|
{{- $title := .Title | default .Site.Title -}}
|
|
|
|
|
{{- $desc := .Description | default .Summary | default .Site.Params.description | plainify | truncate 200 -}}
|
2026-02-05 16:17:07 +01:00
|
|
|
|
|
|
|
|
{{/* Resolve image: page resource cover.* > .Params.image > site default */}}
|
|
|
|
|
{{- $image := "" -}}
|
|
|
|
|
{{- with .Resources.GetMatch "cover.*" -}}
|
|
|
|
|
{{- $img := .Resize "1200x webp q90" -}}
|
|
|
|
|
{{- $image = $img.Permalink -}}
|
|
|
|
|
{{- else -}}
|
|
|
|
|
{{- with $.Params.image -}}
|
|
|
|
|
{{- $image = . -}}
|
|
|
|
|
{{- else -}}
|
|
|
|
|
{{- $image = $.Site.Params.images.default | default "/images/og-default.png" -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
{{- if and $image (not (strings.HasPrefix $image "http")) -}}
|
2025-11-29 17:51:00 +01:00
|
|
|
{{- $image = $image | absURL -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
|
2026-02-05 16:17:07 +01:00
|
|
|
{{/* Determine card type - use large image when we have one */}}
|
2025-11-29 17:51:00 +01:00
|
|
|
{{- $cardType := "summary" -}}
|
|
|
|
|
{{- if $image -}}
|
|
|
|
|
{{- $cardType = "summary_large_image" -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
|
|
<meta name="twitter:card" content="{{ $cardType }}">
|
|
|
|
|
<meta name="twitter:title" content="{{ $title }}">
|
|
|
|
|
<meta name="twitter:description" content="{{ $desc }}">
|
|
|
|
|
|
|
|
|
|
{{- if $image }}
|
|
|
|
|
<meta name="twitter:image" content="{{ $image }}">
|
|
|
|
|
<meta name="twitter:image:alt" content="{{ $title }}">
|
|
|
|
|
{{- end }}
|