Stop adding random string into image url

Hi
I’m having problem that each time build hugo makes new image URL after cropping by adding a random string like home-cover_huced643f4f523a838514eb9186dcef3c6_195383_2200x0_resize_q75_h2_box.webp while file name is home-cover.jpg. I’m okay with consistent name but each time new URL breaks SEO which is not what I want. Is there any fix?

First, the string isn’t random. It’s a cache key that includes a hash and image parameters.

Second, according to John Mueller of Google, if you already provide an alt attribute the filename makes little to no difference. I’ve written about this before:

https://discourse.gohugo.io/t/resizing-images-and-renaming-them/46552/6

And I’m sure your alt attribute is excellent in order to comply with accessibility guidelines.

Third, if you want to rename the image, use the resources.Copy function.

2 Likes

Thank you for guidance will check this.