From: Max Arnold Date: Wed, 7 Nov 2018 13:30:42 +0000 (+0700) Subject: tpl/tplimpl: Featured and Site.Params image support for Schema X-Git-Tag: v0.60.0~6 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c91970c08ddf8c22ca4f967c2cc864c483987ac7;p=brevno-suite%2Fhugo tpl/tplimpl: Featured and Site.Params image support for Schema --- diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index fd8ecc38..cb7fb951 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 a76dbdd4..19648abe 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