diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index b3e9d33..dc5ed41 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -23,16 +23,34 @@ {{ with .PublishDate }}{{ end }} {{ with .Lastmod }}{{ end }} +{{ with .Params.thumbnail }} +{{/* $thumbPath := (add $.Page.RelPermalink . ) */}} +{{ $thumbnail := $.Resources.Get . }} +{{ with $thumbnail }} +{{ $img := $base.Filter (images.Overlay (.Process "fit 300x250") 875 38 )}} +{{ $img = $img.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 }} +{{ else }} {{ $img := $base.Filter (images.Text .Page.Title (dict "color" "#d8d8d8" "size" 64 "linespacing" 2 "x" 40 - "y" 240 + "y" 300 "font" $font ))}} -{{ $img = resources.Copy (path.Join .Page.RelPermalink "og.png") $img }} +{{ $img = resources.Copy (path.Join $.Page.RelPermalink "og.png") $img }} {{ .Scratch.Set "og_image" $img }} +{{ end }} {{- end -}} {{ $img := .Scratch.Get "og_image" }}