Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm use RoR 3.2 and carrierwave gem for upload images.

I want will do SEO optimization for uploaded images filenames. For example I have model Car(attributes: :id, :name, :avatar(carrierwave image uploader for this)) and model Brand(attributes: :id, :name).

After upload avatar for car, it creates an image with name test1.jpg. I want display this filename as brand_name-car_name-filename.jpg. And if the brand (or car) name changed - consider and display the correct brand name and car name.

Is this important for SEO?

share|improve this question

migrated from stackoverflow.com Jun 27 at 13:43

This question came from our site for professional and enthusiast programmers.

1  
When you generate the Carrierwave uploader file rails generate uploader Avatar it gives you a store_dir method which you can override. For example: uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.name} (not tested). Similar question stackoverflow.com/questions/12738700/… –  Mark Kenny Jun 24 at 21:17
    
thanks Mark. but if brand(or car) name changed - I need recreate this file(change name). and if cars for this brand very more - need do it for all cars. –  Artem Pecherin Jun 24 at 21:26
1  
You could change the filename on your filesystem using the File class with the rename class method File.rename('old_car_brand.jpg', 'new_car_brand.jpg') (or something like that). You could trigger this if the name attribute is changed, (remembering to also change the avatar attribute to reflect the new name too) –  Mark Kenny Jun 24 at 21:49
    
@MarkKenny, I thought to do everything exactly the same. But I doubt the optimality of such a decision. –  Artem Pecherin Jun 24 at 21:54
    
Another approach could be to create a new record in the database with a new avatar (file upload). You would then set the old record status attribute to "Archived". This might be good for versioning and Google will like it too. –  Mark Kenny Jun 24 at 22:13

1 Answer 1

The filename of the image is just one of the items that image search engines (like Google Image Search) use to rank images. They also can get text from:

  • The alt attribute of the image
  • The title attribute of the image
  • Text that is in a <div> that directly surrounds the image and displays on the page right next to the image

User visible text seems to be a stronger signal than meta text (such as alt text or file name), so if I were to choose one of the two, I wouldn't worry too much about the file name.

You also need to pay attention to two other major factors to get your images to rank:

  • PageRank -- The number and quality of inbound links (even internal links) into the page that has the image
  • Image quality -- Full color and very large images rank much better than lower quality images.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.