Find an image named "thumbnail" if none is given as a param

This commit is contained in:
Eryn Wells 2022-11-28 17:28:43 -08:00
parent 4231c6c5d8
commit fe8e12a2ba
2 changed files with 6 additions and 2 deletions

View file

@ -1,5 +1,7 @@
{{- $thumbnailResource := .Resources.GetMatch (index .Page.Params "thumbnail")
{{- $thumbnailResource := .Page.Resources.GetMatch
(index .Page.Params "thumbnail" | default "[tT]humbnail*")
| default (index (.Page.Resources.ByType "image") 0) -}}
{{- if not $thumbnailResource -}}
{{- errorf "No thumbnail available for %s" .Page.Permalink }}
{{- end -}}