Change the default folder of the resources.Get parameter

{{ $image := resources.Get "images/logo.jpg" }}
{{ with $image }}
  <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
{{ end }}

The code above brings me the logo.jpg file in the images folder under the assets folder.

I want to make this assets folder a static folder.

How can I do that?

You cannot process images in the static folder. Only from assets.

BUT you can mount static as assets with something like this :

[module]
    [[module.mounts]]
        source = "static/img_as_assets"
        target = "assets/img_from_static"

And then use:

{{ $image := resources.Get "img_from_static/logo.jpg" }}

Hugo is a real magic tool for anything (except may be a good Italian expresso)

Thank you for your answer, but unfortunately the {{ $image := resources.Get "img_from_static/logo.jpg" }} part did not work

Can you show ALL your code. It is impossible to guess what goes wrong

But you have the idea : mount your static folder like it was an assets folder.

And then all under static is magically like an assets resource

obviously you have to put the logo.jpg inside the img_as_assets folder or adapt the mount directive.

I hope you understood this.

config.toml file:

[module]
  [[module.mounts]]
    source = "static/img_as_assets"
    target = "assets/img_from_static"

single.html file:

{{ $image := resources.Get "img_from_static/images/logo.jpg" }}
{{ with $image }}
  <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
{{ end }}

folder structure:

image

I don’t necessarily have to solve the problem with this parameter, I just need a code that I can get the size and width of the images in my static folder.

you didn’t read my response. Your folder stucture is wrong (or the mount directive)

I really don’t know exactly what to do. Can you give me an example?

- assets
- static
  * static/img_as_assets

but you really need to read the Hugo folder organisation documentation.

Yes, now I understand the logic. I look at the texts from the translation because my English is not enough, so I did not understand what you said at first. Thank you for your help.