mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-22 23:12: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 }}" />
|
<meta property="article:section" content="{{ .Section }}" />
|
||||||
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
{{ 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 .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
|
{{ $img := $base.Filter (images.Text .Page.Title (dict
|
||||||
"color" "#d8d8d8"
|
"color" "#d8d8d8"
|
||||||
"size" 64
|
"size" 64
|
||||||
"linespacing" 2
|
"linespacing" 2
|
||||||
"x" 40
|
"x" 40
|
||||||
"y" 240
|
"y" 300
|
||||||
"font" $font
|
"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 }}
|
{{ .Scratch.Set "og_image" $img }}
|
||||||
|
{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ $img := .Scratch.Get "og_image" }}
|
{{ $img := .Scratch.Get "og_image" }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue