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 am a big fan of minifying everything whenever possible. It is a sin for me to don't do this.

However, I recently read that one of the thousands tips to boost your website rank on search engines was to:

give you content context with good class and id name in your HTML

[source]

I always change id and class names to one or two character length...

Is not that I don't believe what that guy said, but I really need some confirmation on this. For me it doesn't make sense why would that matter.

  • Is that point correct?
  • (in case it is) Why?
share|improve this question

3 Answers 3

up vote 7 down vote accepted

I wouldn't worry about ID and class names. Although the most popular ID names did affect new HTML5 tags names (header, footer, etc) and may help non HTML5 sites show distinct sections of their pages, I wouldn't go so far as to say including keywords in them affect rankings. I would be sure to use proper HTML tags and microformats, however. We know as a fact that search engines use those as rankings factors or at the very least that they can affect how search engines display your content in their search results which can affect your click through rate.

share|improve this answer

No, it is not correct and unfortunately that is one of the lower quality answers to that question that somehow got upvotes. I edited it to remove that line.

Class names and ID names in HTML make no difference to SEO. One exception is the case of microformats where search engines parse them, and may display certain extra snippets in search results.

There is no need to try and "minify" your HTML. Make sure the server is sending the content gzipped as that makes a big difference.

Note that many of the answers to that question are not things that would directly improve search rankings, most are about site visibility and promotion, which are long-term, indirect ranking factors.

share|improve this answer

I don't think ID's nor classes matter SEO wise.

However: why are you changing id and class names to 1 or 2 characters? What do you gain from it? If you are doing it for performance, don't do it. Minifying them only gives you a very tiny gain. And the only thing you got is unreadable, unrecognizable stuff.

share|improve this answer
    
I keep a copy of the unminified version –  ajax333221 Feb 5 '12 at 0:29
    
But why do you do it in the first place I'm wondering? –  PeeHaa Feb 5 '12 at 0:31
    
lower file-size = lower time to download. classes and IDs appear around 100 times on html+css, so if I can reduce 5 chars * 100 times... I save 500 chars –  ajax333221 Feb 5 '12 at 0:33
    
@ajax sounds like micro-optimization to me - consider that you'll save a few hundred bytes by this, while every JPG will cost you hundreds of times that. Plus proper gzip compression will take care of those patterns anyway. But I guess there's no harm in doing this, either –  Pekka 웃 Feb 5 '12 at 0:39
    
@ajax333221 ^^ It doesn't just sound like it. It's just is :-) –  PeeHaa Feb 5 '12 at 1:23

Your Answer

 
discard

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

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