{{ $img := resources.Get "og_base.png" }} {{ $text := "" }} {{ $font := "" }} {{ $path := os.Getenv "HUGO_REMOTE_FONT_PATH" }} {{ with resources.GetRemote $path }} {{ with .Err }} {{ errorf "%s" . }} {{ else }} {{ $font = . }} {{ end }} {{ else }} {{ errorf "Unable to get resource %q" $path }} {{ end }} {{- if .IsHome }} {{ $text = .Site.Params.Description }} {{- end }} {{- if .IsPage }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{ with .PublishDate }}{{ end }} {{ with .Lastmod }}{{ end }} {{ $text = .Page.Title }} {{ end }} {{- with .Params.thumbnail }} {{ $thumbnail := $.Resources.Get . }} {{ with $thumbnail }} {{ $img = $img.Filter (images.Overlay (.Process "fit 300x250") 875 38 )}} {{ end }} {{ end }} {{ $img = $img.Filter (images.Text $text (dict "color" "#d8d8d8" "size" 64 "linespacing" 2 "x" 40 "y" 300 "font" $font ))}} {{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }} {{- with .Params.audio }}{{ end }} {{- with .Site.Params.title }}{{ end }} {{- with .Params.videos }}{{- range . }} {{ end }}{{ end }}