add cover image from front matter,

set auto cover grab as backup following similar hugo standard
This commit is contained in:
Adam Ormsby 2020-04-28 20:58:39 -05:00
parent b52428a2cf
commit 2583a1c4bf

View file

@ -28,6 +28,15 @@
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description> <description>
{{ if .Params.Cover }}
{{ if .Params.UseRelativeCover }}{{ printf "%s%s%s%s" "<image src=\"" .Permalink .Params.Cover "\"/>"}}
{{ else }}{{ printf "%s%s%s" "<image src=\"" (.Params.Cover | absURL) "\"/>"}}
{{ end }}
{{ else }}
{{ $images := .Resources.ByType "image" }}
{{ $featured := $images.GetMatch "{*featured*,*cover*,*thumbnail*}" }}
{{ with $featured }}{{ printf "%s%s%s" "<image src=\"" $featured.Permalink "\"/>"}}{{ end }}
{{ end }}
{{ .Summary | html }} {{ .Summary | html }}
</description> </description>
</item> </item>