From b147fa0a683e94d761ec96be646dc7407d5b9909 Mon Sep 17 00:00:00 2001 From: Timon Back Date: Fri, 14 Apr 2023 21:24:46 +0200 Subject: [PATCH] Allow loading cover from assets folder 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 5c5f2fb..0f8bfbc 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 -}}