From f4fd472e6e6710ef3b9a283f33b0180965f30700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Tue, 13 Feb 2024 21:25:46 +0000 Subject: [PATCH] Fix background image mode in list view --- layouts/partials/hero/background.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html index ac4adb8a..f43cd843 100644 --- a/layouts/partials/hero/background.html +++ b/layouts/partials/hero/background.html @@ -4,11 +4,22 @@ {{- $featured := $images.GetMatch "*background*" -}} {{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} + {{ if and .Params.featureimage (not $featured) }} {{- $url:= .Params.featureimage -}} {{ $featured = resources.GetRemote $url }} {{ end }} -{{- if not $featured }}{{ with .Site.Params.defaultBackgroundImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}} + +{{- if not $featured }} + {{ with .Site.Params.defaultBackgroundImage }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $featured = resources.GetRemote . }} + {{ else }} + {{ $featured = resources.Get . }} + {{ end }} + {{ end }} +{{ end -}} + {{ $isParentList := eq (.Scratch.Get "scope") "list" }} {{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList))