diff --git a/src/themes/seatable/layouts/partials/head/head.html b/src/themes/seatable/layouts/partials/head/head.html index 68faf5609..06f7ae6c6 100644 --- a/src/themes/seatable/layouts/partials/head/head.html +++ b/src/themes/seatable/layouts/partials/head/head.html @@ -58,7 +58,7 @@ - {{ template "_internal/opengraph.html" . }} + {{ partial "opengraph/opengraph.html" }} {{ template "_internal/twitter_cards.html" . }} {{ partialCached "head/css.html" . }} diff --git a/src/themes/seatable/layouts/partials/opengraph/get-featured-image.html b/src/themes/seatable/layouts/partials/opengraph/get-featured-image.html new file mode 100644 index 000000000..ea42ecdb7 --- /dev/null +++ b/src/themes/seatable/layouts/partials/opengraph/get-featured-image.html @@ -0,0 +1,28 @@ + + +{{ $images := $.Resources.ByType "image" }} +{{ $featured := $images.GetMatch "*feature*" }} +{{ if not $featured }} + {{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} +{{ end }} +{{ if not $featured }} + {{ $featured = resources.Get "/opengraph/gohugoio-card-base-1.png" }} + {{ $size := 80 }} + {{ $title := $.LinkTitle }} + {{ if gt (len $title) 20 }} + {{ $size = 70 }} + {{ end }} + + {{ $text := $title }} + {{ $textOptions := dict + "color" "#FFF" + "size" $size + "lineSpacing" 10 + "x" 65 "y" 80 + "font" (resources.Get "/opengraph/mulish-black.ttf") + }} + + {{ $featured = $featured | images.Filter (images.Text $text $textOptions) }} +{{ end }} + +{{ return $featured }} diff --git a/src/themes/seatable/layouts/partials/opengraph/opengraph.html b/src/themes/seatable/layouts/partials/opengraph/opengraph.html new file mode 100644 index 000000000..a268697a2 --- /dev/null +++ b/src/themes/seatable/layouts/partials/opengraph/opengraph.html @@ -0,0 +1,82 @@ + + + + + + + +{{- with $.Params.images -}} + {{- range first 6 . }} + + {{ end -}} +{{- else -}} + {{- $featured := partial "opengraph/get-featured-image.html" . }} + {{- with $featured -}} + + {{- else -}} + {{- with $.Site.Params.images }} + + {{ end -}} + {{- end -}} +{{- end -}} + +{{- if .IsPage }} + {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + + {{ with .PublishDate }} + + {{ end }} + {{ with .Lastmod }} + + {{ end }} +{{- end -}} + +{{- with .Params.audio }}{{ end }} +{{- with .Params.locale }} + +{{ end }} +{{- with .Site.Params.title }} + +{{ end }} +{{- with .Params.videos }} + {{- range . }} + + {{ end }} + +{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{ with .Params.series }} + {{- range $name := . }} + {{- $series := index $siteSeries ($name | urlize) }} + {{- range $page := first 6 $series.Pages }} + {{- if ne $page.Permalink $permalink }} + + {{ end }} + {{- end }} + {{ end }} + +{{ end }} + +{{- /* Facebook Page Admin ID for Domain Insights */}} +{{- with site.Params.social.facebook_admin }} + +{{ end }}