From 0f40733d46b80c0e569728452fdd9bde38b822db Mon Sep 17 00:00:00 2001 From: "Steven G. Harms" Date: Mon, 29 Mar 2021 07:05:57 -0400 Subject: [PATCH] Changes .GetMatch Pattern to find bundled assets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I attempted to use `func/GetFeaturedImage.html`, it did not find my resource, `images/foo-cover.webp`. Updating the match syntax to the pattern expressed here, provided expected behavior: Per: https://gohugo.io/content-management/page-resources/#pattern-matching > .Resources.Match "*sunset.jpg" 🚫 and... > .Resources.Match "*" 🚫 Are not expected to work > .Resources.Match "**/sunset.jpg" ✅ which follows this change, does. --- layouts/partials/func/GetFeaturedImage.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/func/GetFeaturedImage.html b/layouts/partials/func/GetFeaturedImage.html index c00b086..226a8b3 100644 --- a/layouts/partials/func/GetFeaturedImage.html +++ b/layouts/partials/func/GetFeaturedImage.html @@ -24,7 +24,7 @@ {{/* Find the first image with 'cover' in the name in this page bundle. */}} {{ else }} - {{ $img := (.Resources.ByType "image").GetMatch "*cover*" }} + {{ $img := (.Resources.ByType "image").GetMatch "**/*cover*" }} {{ with $img }} {{ $linkToCover = .Permalink }} {{ end }}