Using .GetRemote on image puts the resource in root

I’m having a great time playing around with resources.GetRemote and working on integrating it with Directus CMS. However, I’m noticing a pattern that I’d like to ask about: when I fetch an image with resources.GetRemote, process that image with Hugo Pipes, and finally run hugo, the generated resource is placed in public/ instead of public/images.

Is there any way to make sure that remote images end up in public/images, like local images that are processed with Hugo Pipes? I’d like to keep the root cleaner, if possible.

You have some form of code that processes the image and in that code you call the image “image.jpg”. Call it “images/image.jpg” and your wish will be granted.

You could also just post a sample of your code and we’ll tell you where the magic happens. That’s easier.

Try This:

  {{ $img := resources.GetRemote "REMOTE_URL_TO_IMAGE" }}
  {{ $img := $img.Content | resources.FromString "images/FILENAME.EXT" }}
  <img src="{{ $img.RelPermalink }}">


That is a brilliant way to store a remote image within a specified directory in a Hugo project .

Hats off to you! :tophat:


There’s an open issue…

@pamubay Thank you for that solution! It works just like I had hoped. I thought there might be something with resources.FromString, but I assumed that method would only accept strings.

@jmooring Thank you for linking to the Github issue, which I clearly missed while searching there. I must have assumed that the title of that issue didn’t relate to my question.

So, lesson for the day: stop assuming!

I just used your method for a project and it’s working great.

Also I think that @regis needs to see your post (since he opened the linked GitHub issue).

1 Like

Yes! I’ve seen it and will remember to use that if the mentioned issue is not addressed before I need this! :slight_smile: resource.FromString gets so much done these days! :smiley:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.