mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2026-11-22 12:39:04 +00:00
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.
This commit is contained in:
1 file changed
+4
-3
@@ -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 */}}
|
||||
|
||||
|
||||
Reference in new issue
Block a user