From 65e4aa52692ac2f68190dc3b0f3adfceb272ed3c Mon Sep 17 00:00:00 2001 From: Nedjo Rogers Date: Tue, 12 Apr 2022 15:47:08 -0700 Subject: [PATCH] When loading a featured image, support global image resources (#326) --- layouts/partials/func/GetFeaturedImage.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/layouts/partials/func/GetFeaturedImage.html b/layouts/partials/func/GetFeaturedImage.html index 1c8dd3b..5ceeb15 100644 --- a/layouts/partials/func/GetFeaturedImage.html +++ b/layouts/partials/func/GetFeaturedImage.html @@ -20,7 +20,17 @@ {{ $matches := "feature,cover" }} {{/* Use the value from front matter if present */}} {{ with .Params.featured_image }} - {{ $coverImage = . }} + {{/* If we find a remote global Resource matching the exact value, we use it. */}} + {{ if (hasPrefix . "http") }} + {{ with resources.GetRemote . }} + {{ $coverImage = . }} + {{ end }} + {{ else }} + {{/* If we find a local global Resource matching the exact value, we use it. */}} + {{ with resources.Get . }} + {{ $coverImage = . }} + {{ end }} + {{ end }} {{/* If we find a Page Resource matching the exact value, we use it instead. */}} {{ with $.Resources.GetMatch . }} {{ $coverImage = . }}