I am wondering if .Resource.ByType only looks for the given type in the immediate root folder of the current page, or if it will also look in the subfolders of that page. Based on that post, it seems it’s only the root folder.
This doc page doesn’t give any indication on the scope of the function:
I believe (but haven’t tested) the issue in that case is not the .ByType but the .GetMatch
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
Even if .ByType returns from all subdirectories of a leaf bundle, the .GetMatch glob pattern would fail to match the directory separator (/ on *nix systems, not sure if it is normalized or not). Based on
I think **cover* is what would have the desired effect.