BACKTRACE

(condense)

Back to Posts List

GET

Rails Tip: image_tag, SEO Optimization

when you use rails’s image_tag, by default it sets the HTML attributes of alt and title to the filename of the image. so for
<br />image_tag 'dscn0001.jpg'<br />
will produce the following html something like that
<br />&lt;img src="images/dscn0001.jpg" alt="dscn0001" /&gt;<br />

the alt attribute for image tag is meant to explain the content of the image in case the actual image was not found, or for non-graphic browsers.

The default value for the alt attribute should not be used, unless the file name does not really supply information about the image. my suggestion is to use the :alt option in the image_tag helper.

important: do not attempt to use the alt for keywords heaping (‘elad-rails-blog-ruby.jpg’), this will not help you in your SEO.

POST

blog comments powered by Disqus

I Don't have cookies.

ELAD ENV

Variable Value
LINKEDIN
TWITTER
FACEBOOK
GITHUB
WWR
IRC
{ 'irc.freenode.net' => [ '#rubyonrails', '#railsbridge', '#ruby', '#mootools' ]}
SKYPE
eladmeidar

You're seeing this error because I think it is funny.