diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index 2d5c966..eba61bd 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -1,21 +1,13 @@ -{{ $base := resources.Get "og_base.png" }} +{{ $img := resources.Get "og_base.png" }} {{ $font := resources.Get "/FiraMono-Regular.ttf" }} +{{ $text := "" }} {{- if .IsHome }} -{{ $img := $base.Filter (images.Text .Site.Params.Description (dict - "color" "#d8d8d8" - "size" 64 - "linespacing" 2 - "x" 40 - "y" 300 - "font" $font -))}} -{{ $img = resources.Copy "og.png" $img }} -{{ .Scratch.Set "og_image" $img }} +{{ $text = .Site.Params.Description }} {{- end }} {{- if .IsPage }} @@ -23,11 +15,15 @@ {{ with .PublishDate }}{{ end }} {{ with .Lastmod }}{{ end }} -{{ with .Params.thumbnail }} +{{ $text = .Page.Title }} +{{ end }} + +{{- with .Params.thumbnail }} {{ $thumbnail := $.Resources.Get . }} {{ with $thumbnail }} -{{ $img := $base.Filter (images.Overlay (.Process "fit 300x250") 875 38 )}} -{{ $img = $img.Filter (images.Text $.Page.Title (dict +{{ $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 @@ -36,22 +32,6 @@ "font" $font ))}} {{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }} -{{ $.Scratch.Set "og_image" $img }} -{{ end }} -{{ else }} -{{ $img := $base.Filter (images.Text .Page.Title (dict - "color" "#d8d8d8" - "size" 64 - "linespacing" 2 - "x" 40 - "y" 300 - "font" $font -))}} -{{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }} -{{ .Scratch.Set "og_image" $img }} -{{ end }} -{{- end -}} -{{ $img := .Scratch.Get "og_image" }}