2

In terms of cache optimization it is recommended for static files like images to cache them forever. In this case if you want to update an image you have to use a different file name so that the client browser downloads the new image instead of showing the cached one.

Situation 1

I don't cache image files. So if I update the file myimage.png the file name remains the same.

Situation 2

I cache image files forever. That's why I use a hash in the file name.

File name before update: myimage.a1b2c3.png

File name after update: myimage.d4e5f6.png

Question

Am I right that file names without hashes are way better in terms of SEO?

2
  • Do you expect to update images after a certain time? If so, what could be a tentative timeframe?
    – Kannan
    Commented Jun 11, 2021 at 10:57
  • Yes, there might be updated images after an uncertain time. Commented Jun 11, 2021 at 11:46

1 Answer 1

2

On a long-term basis, I don't think there will be any differences in SEO impact (image-SEO) between the above two methods.

But, there could be short-term SEO impacts when changing filenames during updates.

Google is known to remove non-existent resources from the index after some delay (you can call it a grace period). Whenever you update an image, Google could take some time between de-indexing the old one and indexing the new one.

My suggestion is this:

Maintain filenames (to prevent short term SEO impacts mentioned earlier) with appropriate cache-control headers (for better user experience). You can set the max-age to a reasonable time depending upon a tentative update time in the future and can add must-revalidate directive. By this, whenever an image changes, the browser would pick the latest from the server. Otherwise, guided by max-age, the browser can use the cached copy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.