Feature Request - Custom URL Shortening in Hugo for images


I have become a fan of Hugo’s features and automation it provides for easy project management. It is really easy to start and great community support specially from people such as @jmooring @regis

While I enjoy using Hugo, there’s one thing that bothers me - long and complex URLs for images and lack of custom pages url which can including values from front matter.

So, that being said Here’s my request: Make it easier to create custom, shorter, and more meaningful URLs

For images, I’d like to use values from the content’s front matter to make URLs like “:section-:Param.Aparam-:title.” and create hash for a limited number of digits instead of very long url it currently generates. This way, I can have neat and descriptive image URLs. Which can be defined in Hugo config for a section.

For pages, it would be great to include front matter values in URLs and configure this in Hugo’s config. there are existing options such as /:year/:month/:slug/ but if there was a way to extend it to include params value I will be able to generate more meaningful urls.

This change would simplify managing content and create cleaner URLs and I do not have to manually add the url: value for each page.

Thanks for considering this!

Copy is your friend:

1 Like

Hi @chrillek

I am familiar with copy it take static value and only applies to the specific images. My request is to have the ability to modify the default behaviour to some extend the same way we can control the image quality from the default 75 to any number of our choice and it applies to the whole project.

Also copy doesn’t help in case of the page url modification. my sub request in this feature request.


I’m using it in my image render hook and it does what I want. In the same way as the image render hook creates the different image sizes etc. In what respect wouldn’t Copy work in your case if you used it in the image render hook?

I tried that but I was left on read. So, I went back to those ugly long image URLs. It is a complicated feature. https://discourse.gohugo.io/t/45191

1 Like

Hi @Arif

Images play very big role in SEO and google have made clear that images should Use descriptive filenames, titles while Hugo gives me benefit with performance it made really difficult and a lot of manual work to use descriptive image filenames.

It also is true in my case for page generations where I am limited to use title, date etc. but cannot use combination from page params.

I will still use hug even if there is no solution of this issue but I would love it more and made my life easier with less manual work to generate sites with descriptive image and page urls.


Most of my images are decorative. So, I can bear with the situation for now. But resources.Copy ought to be extended to the image processing in general.