.Resources.ByPrefix requires dir path since .33

It seems that .Resources.GetByPrefix since .33 requires full rel url/path

{{ .Resources.GetByPrefix "featured" }} > :no_entry_sign:

{{ .Resources.GetByPrefix "images/featured" }} > :white_check_mark:

{{ .Resources.GetByPrefix "images" }} > Returns first image found in dir.

It is as designed ? It may bring unexpected behaviour when dirname is similar to filename and it is a code breaker (for early adopters anyway;)

1 Like

Design and design …

It was unintended. But it was part of the bigger picture, and I think it is correct and sensible behaviour. I expaneded the Resource interface with (among others) the Name method. This is the method used in the prefix methods.

And you can set that value in the “resource metadata”. And it kind of makes sense for bigger bundles to include the folder.

I think I’m going to just update the release notes about this. I think. But that will have to wait for later …

But could you create a GH issue about this? I need to think a little about this.

I have thought about this, and you are right:

I will fix this soon, but I will wait a few days to do a patch release – there may be other issues.

Yes it can wait.
It was an easy fix on my theme once I found out what broke it.

Tks for creating the GH issue. Was about to do it.

Cheers,