From da6c845d062d15dc097a4249521d32010d7ac80d Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 26 Jul 2020 14:47:51 +0200 Subject: [PATCH] cleanup image and thumbnail handling --- layouts/partials/head/schema.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/layouts/partials/head/schema.html b/layouts/partials/head/schema.html index a255f72..c3a925e 100644 --- a/layouts/partials/head/schema.html +++ b/layouts/partials/head/schema.html @@ -1,4 +1,5 @@ {{ if .IsHome -}} +{{ $thumbnail := default (default "brand.svg" .Site.Params.logo) (index .Site.Params.images 0) | absURL }} {{ else if .IsPage }} {{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }} -{{ $images := default (slice (default "brand.svg" .Site.Params.logo)) .Params.images }} {{ $description := default .Site.Params.description (default .Description .Summary) }} {{ $ac := 0 }} {{ $ac_max := default 0 (len $authors) }} @@ -68,7 +68,13 @@ "height":"32" } }, - "image": [{{ range $i, $image := $images }}{{ if $i }}, {{ end }}{{ $image | absURL }}{{ end }}], + {{- with $images := $.Resources.ByType "image" }} + "image": [ {{ range $i, $image := $images }}{{ if $i }}, {{ end }}"{{ $image.Permalink | absURL }}" {{ end }}], + {{- else }} + {{- with $images := .Params.images }} + "image": [ {{ range $i, $image := $images }}{{ if $i }}, {{ end }}"{{ $image | absURL }}" {{ end }}], + {{- end }} + {{- end }} "url" : "{{ .Permalink }}", "wordCount" : "{{ .WordCount }}", "genre" : [ {{ range $i, $tag := .Params.tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}]