mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-12-24 11:52:19 +00:00
include article thumbnail in opengraph image (where present)
This commit is contained in:
parent
7d162f7295
commit
7529d0a664
1 changed files with 20 additions and 2 deletions
|
@ -23,16 +23,34 @@
|
|||
<meta property="article:section" content="{{ .Section }}" />
|
||||
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
||||
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ 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" }}
|
||||
|
||||
|
|
Loading…
Reference in a new issue