Image Processing - prevent url change

Currently, at least from my use, when using hugo’s image processing, Hugo changes the URI of the image, so currently:




Is their a way to prevent this name change OR is their a way to predict that name change?

As I might be asking the wrong question, the issue I would like to resolve is:

Front matter:


thumbnail: /images/busy-city.jpg


This is used in the respective layout to generate a thumbnail used on a HUGO list page.

Buenicimo Perfect.

THEN, later, I have a search function with JS, it all works. I output all I need to search through using Hugo’s config output with a /index.json. I fetch that all is happy.
I have the above front matter in the index.json file: thumbnail: /images/images/busy-city.jpg

But as image processing has changed the URL, I now have to with JS, I think, fetch the page where the image appears, with regex compare to find that images new URL, and now display.

Preferably, I can just set the URL to not change on build or to predictably change (i.e. append “processed…”)

This might be a super isolated use case, but if their is a way, it would really help me.

Thank you for everyone’s’ time.

Sometimes, you just need to get a stupid question out of your soul to see the answer…

I’m just going to create a new hugo processed link of the thumbnail to use in the search in the index.json template.

In case their is better, wanted to leave this here.

If I understood the question the correctly, support for your request is coming in v0.100.0: resources.Copy.

An example from the source issue page:

{{ $resized := $image.Resize "400x400" |  resources.Copy "images/mynewname.jpg" } }}
<img src="{{ $resized.RelPermalink }}">



Thanks mate, see below. That’s what I need… (but yet, I guess this future update might handle too).


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