From d6f911cc05c60e3cb7567b8f523ee8f9143cb43d Mon Sep 17 00:00:00 2001 From: Timon Back Date: Fri, 28 Apr 2023 16:43:57 +0200 Subject: [PATCH] Allow loading cover from assets folder (#1187) By default, the cover is loaded from the page resources folder (same folder). If the image is not found, the (global) assets folder is searched as well. If found, the same processing is done. Otherwise, the fallback remains with linking to the image directly. --- layouts/partials/cover.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index 5c5f2fbb..0f8bfbce 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -4,7 +4,9 @@
{{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }} {{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }} - {{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- $globalResourcesCover := (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- $cover := (or $pageBundleCover $globalResourcesCover)}} {{- if $cover -}}{{/* i.e it is present in page bundle */}} {{- if $addLink }}{{ end -}}