大网数据广告活动
网站运营与故障问答

How does hash in file name affect google image search ranking?

· 52CE 我爱测

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 …

问题原文

原帖链接 · Sr. Schneider · CC BY-SA 4.0

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?

已采纳解答

原帖链接 · Kannan · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2021-06-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。