#Is it possible to have static image URLs?

1 messages · Page 1 of 1 (latest)

high cloud
#

I noticed today that URLs for images on my site have changed. So references on other websites are breaking. Is it possible to make it so that the slugs for images don't change?

quartz dune
#

You can place images in the public folder but they won't be optimized.

You can also generate images with an endpoint, which is how I handle OpenGraph images in my projects.

There might be some other ways too... but by default optimized images will be hashed.

high cloud
#

Dang, alright. I think might try the endpoint approach. It just kind of sucks that all the hashes might change at some point in the future. The hashes seem to have changed with the latest minor version change, but I could be mistaken

quartz dune
#

Yeah, you can't depend on those hashes remaining constant. If you change some of the arguments the output will change. Endpoints work pretty well if it's OG images you're looking for. If you are hosting images that are being referenced elsewhere... well, I suppose you could also just write a little post-build script to strip out the hash using regex. (I have a similar script for removing built images that don't end up referenced in my project at all, usually high-resolution originals that are just taking up space.)