Resources.Match outside assets folder

Hello

I’m trying to get a resources.match outside the assets folder.

My current structure is:

/content/
_index.md
    /issue-1/
      _index.md
      some-title.md
      /img/  
      image1.jpg

I want to show the image1.jpg from the /img/ folder, but when I do {{ (resources.Get "**.jpg").RelPermalink }} to at least see if the code works I get the usual The filename, directory name, or volume label syntax is incorrect.

I get that Hugo can’t read the img folder because its expecting to look into the /assets/ folder, but how do I tell it to look inside my content/issue-X/img

I’m generating the current issue number like so:

issue_data.toml

[issue]
current = "1"

regular expression {{ $issue.current }}

{{ $issue_data := .Site.Data.issue_data.issue -}}

{{ $issue__data := trim .Section "issue-" -}}

{{ $issue := index $issue_data $issue__data -}}

From the page bundle docs on “Where can the resources live?”

Only in the directory level of the branch bundle directory i.e. the directory containing the _index.md

So if you want to use _index.md, you need to move your images up a directory.

I have one already there, sorry, forgot to mention.

Since you are getting an image (which is considered a “page resource” in this case) from a page bundle, you need to use different syntax. For example:

{{ $img := .Resources.GetMatch "*.jpg" }}
{{ $img.RelPermalink }}

See the page resource docs for more examples of getting matches