{{- /* Builds the social card for a post: dot-grid base + entry meta + wrapped title. Returns an image resource. */ -}} {{- $p := . -}} {{- $base := resources.Get "og/og-base.png" -}} {{- $titleFont := resources.Get "fonts/Inter-Bold.ttf" -}} {{- $monoFont := resources.Get "fonts/JetBrainsMono-Regular.ttf" -}} {{- $meta := printf "№ %s · %s" (partial "entry-no.html" $p) ($p.Date.Format "2006-01-02") -}} {{- $words := split $p.Title " " -}} {{- $lines := slice -}} {{- $cur := "" -}} {{- range $words -}} {{- if and $cur (gt (len (printf "%s %s" $cur .)) 25) -}} {{- $lines = $lines | append $cur -}} {{- $cur = . -}} {{- else -}} {{- $cur = strings.TrimSpace (printf "%s %s" $cur .) -}} {{- end -}} {{- end -}} {{- $lines = $lines | append $cur -}} {{- $title := delimit $lines "\n" -}} {{- $img := $base.Filter (images.Text $meta (dict "font" $monoFont "color" "#58a6ff" "size" 28 "x" 84 "y" 180)) (images.Text $title (dict "font" $titleFont "color" "#e6edf3" "size" 66 "linespacing" 14 "x" 84 "y" 240)) -}} {{- return $img -}}