Ensure featureimage is present before calling resources.GetRemote

Also added ability to set author image as external url and updated
relevant documentation in configuration
This commit is contained in:
Aakash Nand
2024-02-10 23:04:54 +09:00
parent 289b3ff7ad
commit 19520b4481
11 changed files with 95 additions and 37 deletions
@@ -40,8 +40,10 @@
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{ if .Params.featureimage }}
{{- $url:= .Params.featureimage -}}
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
{{ end }}
{{- if not $featured }}{{ with .Site.Params.defaultFeaturedImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
{{ if .Params.hideFeatureImage }}{{ $featured = false }}{{ end }}
{{- with $featured -}}