{{- if .IsHome }} {{- $img := resources.Get "/social/social_home.png" }} {{- $img := $img | resources.Fingerprint "md5" }} {{ template "_internal/opengraph.html" . }} {{ template "_internal/twitter_cards.html" . }} {{- else if not .File }} {{- else }} {{- $base := resources.Get "/social/social_base.png" }} {{- $font := resources.Get "/fonts/Inter-Medium.ttf"}} {{- $text := "" }} {{- range $index, $ancestor := .Page.Ancestors.Reverse }} {{- if gt $index 1 }} {{- $text = printf "%s%s ‣ " $text $ancestor.Title }} {{- end }} {{- end }} {{- $text = printf "%s%s" $text .Title }} {{- $img_opts := dict "color" "#ffffff" "size" 64 "linespacing" 2 "x" 65 "y" 320 "font" $font }} {{- $img := $base.Filter (images.Text $text $img_opts) }} {{- $img = $img | resources.Copy (path.Join .Page.RelPermalink "social.png")}} {{- $img := $img | resources.Fingerprint "md5" }} {{ template "_internal/opengraph.html" . }} {{ template "_internal/twitter_cards.html" . -}} {{- end }}