3

The Ruby on Rails asset pipeline automatically adds a fingerprint to assets (JS, CSS, and other files in the assets folder including images) upon deployment so that cached assets are automatically served fresh as new files.

Example:

  • Original file: small-dog.jpg
  • Deployed file: small-dog-984943978214378624.jpg
  • Re-deployed file: small-dog-234519389656103219.jpg

Each time a deployment happens, the fingerprint of the file name changes. Two problems I can think of are 404 errors for outdated paths and the possible hurt in SEO ranking of that particular image with the "reset." Do search engines see it as a new image each time, have to crawl it again, and reset its former search ranking?

Google recommends fingerprinting but doesn't say much too about image files in particular.

1

It won't hurt your web page rankings to use those techniques. Your pages will rank in web search just fine even if their assets frequently change URLs.

If you are trying to get the images to rank in Google image search, then unstable image URLs will be a problem. For ranking the image itself, you should choose a URL that is stable.

You can get around the problems of 404 errors by making sure that old ids get redirected to the current version. In my framework I put a timestamp into the URLs for when the build happened. I've found that 301 redirects are great for old timestamps. For future timestamps, 302 redirects work better because you don't want them to be cached.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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