From c91970c08ddf8c22ca4f967c2cc864c483987ac7 Mon Sep 17 00:00:00 2001 From: Max Arnold Date: Wed, 7 Nov 2018 20:30:42 +0700 Subject: tpl/tplimpl: Featured and Site.Params image support for Schema --- tpl/tplimpl/embedded/templates.autogen.go | 19 ++++++++++++++----- tpl/tplimpl/embedded/templates/schema.html | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'tpl') diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index fd8ecc381..cb7fb9512 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -283,17 +283,26 @@ if (!doNotTrack) { {`schema.html`, ` -{{if .IsPage}}{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}{{ if not .PublishDate.IsZero }} +{{- if .IsPage }}{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}{{ if not .PublishDate.IsZero }} {{ end }} {{ if not .Lastmod.IsZero }}{{ end }} -{{ with .Params.images }}{{ range first 6 . }} - -{{ end }}{{ end }} +{{ with $.Params.images }}{{ range first 6 . -}} + +{{ end }}{{ else -}} +{{- $images := $.Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- with $featured -}} + +{{ else -}} +{{- with $.Site.Params.images -}} + +{{ end }}{{ end }}{{ end }} -{{ end }}`}, +{{- end }}`}, {`shortcodes/__h_simple_assets.html`, `{{ define "__h_simple_css" }}{{/* These template definitions are global. */}} {{- if not (.Page.Scratch.Get "__h_simple_css") -}} {{/* Only include once */}} diff --git a/tpl/tplimpl/embedded/templates/schema.html b/tpl/tplimpl/embedded/templates/schema.html index a76dbdd42..19648abef 100644 --- a/tpl/tplimpl/embedded/templates/schema.html +++ b/tpl/tplimpl/embedded/templates/schema.html @@ -1,14 +1,23 @@ -{{if .IsPage}}{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}{{ if not .PublishDate.IsZero }} +{{- if .IsPage }}{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}{{ if not .PublishDate.IsZero }} {{ end }} {{ if not .Lastmod.IsZero }}{{ end }} -{{ with .Params.images }}{{ range first 6 . }} - -{{ end }}{{ end }} +{{ with $.Params.images }}{{ range first 6 . -}} + +{{ end }}{{ else -}} +{{- $images := $.Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- with $featured -}} + +{{ else -}} +{{- with $.Site.Params.images -}} + +{{ end }}{{ end }}{{ end }} -{{ end }} \ No newline at end of file +{{- end }} \ No newline at end of file -- cgit v1.2.3