From ce82e903e4e451102a99a452ac75bfb7a6fc8cfb Mon Sep 17 00:00:00 2001
From: Patrick Kollitsch <davidsneighbourdev+gh@gmail.com>
Date: Fri, 20 Nov 2026 01:51:20 +0000
Subject: [PATCH] feat(images): process responsive header resources

---
 layouts/_partials/func/GetFeaturedImageResource.html |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/layouts/_partials/func/GetFeaturedImageResource.html b/layouts/_partials/func/GetFeaturedImageResource.html
index 2ff28d8..4b49889 100644
--- a/layouts/_partials/func/GetFeaturedImageResource.html
+++ b/layouts/_partials/func/GetFeaturedImageResource.html
@@ -4,7 +4,7 @@
 	This partial gets the featured image resource for a given page.
 
 	If a featured_image was set in the page's front matter and it matches a page
-	resource, then that resource will be used.
+	resource, then that resource will be used. Otherwise, assets are searched.
 
 	If no featured_image was set, this will use the first matching page resource from
 	the page's images front matter array.
@@ -12,7 +12,7 @@
 	If not set, this will search page resources to find an image that contains the word
 	"cover" or "feature", and if found, returns that resource.
 
-	If no matching page resource can be found, this partial returns false.
+	If no matching page or asset resource can be found, this partial returns false.
 
 	@return Featured image resource, or false if not found.
 
@@ -20,7 +20,9 @@
 
 {{ $resource := false }}
 {{ $matches := "feature,cover" }}
+{{ $path := "" }}
 {{ with .Params.featured_image }}
+  {{ $path = . }}
   {{ with $.Resources.GetMatch . }}
     {{ $resource = . }}
   {{ end }}
@@ -28,6 +30,7 @@
   {{ with .Params.images }}
     {{ range first 1 . }}
       {{ with . }}
+        {{ $path = . }}
         {{ with $.Resources.GetMatch . }}
           {{ $resource = . }}
         {{ end }}
@@ -42,4 +45,15 @@
   {{ end }}
 {{ end }}
 
+{{ if and (not $resource) $path }}
+  {{ with resources.Get (strings.TrimPrefix "/" $path) }}
+    {{ $resource = . }}
+  {{ end }}
+{{ end }}
+{{ if $resource }}
+  {{ if ne $resource.ResourceType "image" }}
+    {{ $resource = false }}
+  {{ end }}
+{{ end }}
+
 {{ return $resource }}

--
Gitblit v1.10.0