Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d27b9c0

Browse files
tpl/tplimpl: Extend page image lookup to include global resources
Fall back to global resources via resources.Get when page resources don't match for named images in the images front matter parameter. This aligns get-page-images.html with the existing behavior in render-image.html, render-link.html, and figure.html. Fixes #14062
1 parent 62cef36 commit d27b9c0

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

tpl/tplimpl/embedded/templates/_partials/_funcs/get-page-images.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
{{- $img := . }}
2424
{{- $url := urls.Parse $img }}
2525
{{- if eq $url.Scheme "" }}
26-
{{/* Internal image. */}}
27-
{{- with $resources.GetMatch $img -}}
28-
{{/* Image resource. */}}
26+
{{/* Internal image: check page resources first, then global resources. */}}
27+
{{- with or ($resources.GetMatch $img) (resources.Get $img) -}}
2928
{{- $imgs = $imgs | append (dict
3029
"Image" .
3130
"RelPermalink" .RelPermalink

0 commit comments

Comments
 (0)