diff --git a/layouts/partials/list-item.html b/layouts/partials/list-item.html index d2ab89834..984810d59 100644 --- a/layouts/partials/list-item.html +++ b/layouts/partials/list-item.html @@ -13,9 +13,7 @@

- {{ if .Page.Params.Images }} - {{ partial "helpers/image" (dict "filename" (index .Page.Params.Images 0) "alt" .Page.Title "class" "img-fluid" "resources" .Page.Resources) }} - {{ end }} + {{- partial "post/thumbnail" .Page -}} {{- partial "post/meta" .Page -}}
{{ partial "post/excerpt" .Page }} diff --git a/layouts/partials/post/thumbnail.html b/layouts/partials/post/thumbnail.html new file mode 100644 index 000000000..239bec57c --- /dev/null +++ b/layouts/partials/post/thumbnail.html @@ -0,0 +1,10 @@ +{{ if .Params.images }} + {{ .Title }} +{{- else -}} + {{- $images := .Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + {{- with $featured -}} + {{ .Title }} + {{- end -}} +{{- end -}}