Renaming product images for SEO compatibility not reflected in production site, discussion on using originalFilename property in gatsby-source-sanity.

10 replies
Last updated: Nov 2, 2021
I renamed a lot of product images in the studio to make them SEO compatible.Apparently the name changes aren't reflected in the transferred files of the production site though.

I have tried to redeploy clearing cache and have searched through media to check that no other files with the names ending up in production (f.e.
) still exist.
Are file name changes only cosmetic for the Studio or do I possibly need to take certain additional steps?
Oct 18, 2021, 11:13 AM
Oct 19, 2021, 9:01 AM
Any input on this?

is used in this case.
Oct 25, 2021, 6:46 AM
Hey Leo! Circling back to this. Sanity will always generate a random asset name. For SEO purposes, you can use the
property, as mentioned in this comment. You can find the original filename under
. More on the asset object here .
Nov 1, 2021, 7:23 PM
user M
, thank you for the reply! How exactly should that then be used with
?The comment you have linked to doesn't seem to indicate how to actually achieve that solution. I guess it would be possible to construct a url yourself (f.e. through
) and that would mean not relying on the Sanity helper function or the source plugin (directly) for the image?
Nov 1, 2021, 7:28 PM
Ah, that's a good question. I'm not sure on that one, actually. Let me ask internally.
Nov 1, 2021, 7:33 PM
Ah, that's a good question. I'm not sure on that one, actually. Let me ask internally.
Nov 1, 2021, 7:33 PM
Thank you ๐Ÿ™‚
Nov 1, 2021, 7:33 PM
It seems like this is really similar to what Christopher was looking to do in this thread. Can you try passing the original name as a parameter?
Nov 1, 2021, 9:19 PM
user M
I think he meant more that being able to pass the original filename as a parameter would be nice to have for the future and that he solved it another way without specifying what his workaround was.
user L
Do you mind me asking, what that workaround was?
Nov 1, 2021, 9:22 PM
I'm actually pulling the images through GraphQL, loading them into an array, and then doing a "lookup" (array key) --not ideal.
Nov 2, 2021, 2:56 PM

Sanityโ€“ build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?