From 5f157eba7aff7ede2e067208ba3ba4a2619f2551 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Sat, 24 Oct 2026 17:25:27 +0530 Subject: [PATCH] perf(cover): skip global resources lookup when page bundle has the image The glob over all assets images ran for every list entry and single page even when the page bundle already matched. --- layouts/_partials/cover.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/_partials/cover.html b/layouts/_partials/cover.html index 460e490e..0403b0b8 100644 --- a/layouts/_partials/cover.html +++ b/layouts/_partials/cover.html @@ -7,9 +7,10 @@ {{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }} {{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }} - {{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} - {{- $globalResourcesCover := (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} - {{- $cover := (or $pageBundleCover $globalResourcesCover)}} + {{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- if not $cover }} + {{- $cover = (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- end }} {{- /* We are not using the .Param.cover.relative to decide the location of image */}} {{- /* If we have the image in pageBundle or globalResources we can process the image */}}