Welcome to WebmasterWorld Guest from 54.161.110.186

Forum Moderators: not2easy

Message Too Old, No Replies

naming of class names and ids - does it matter?

     
7:49 pm on May 9, 2012 (gmt 0)

10+ Year Member



With all the latest changes with Google I have been thinking somewhat out-of-the-box from how I've been doing things.

This question popped in my head today... 'does google care what you name your classes and id's in your css?'

Me personally I usually use names like logomain,logosub, leftcontent, rightcontent, footer, blue16, etc... would there be any difference if these were something like :

blue-16, left-content, widget-logo, etc?

If you think about it... eventhough your styling is in the css these classes and id's are used in the actual html of the page.

One would think these words would be parsed OR are they filtered out because they are indeed classes and id's and the crawler knows that? Opinions?
7:51 pm on May 9, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Cetainly name them as what they are for or what they do, rather than what they look like.

e.g. "warning" rather than "red-text".

Hyphen-separators, underscores, camelCaps, I don't think it matters all that much. Just be consistent.
8:10 pm on May 9, 2012 (gmt 0)

10+ Year Member



I was looking for any reason to be more 'clean' in terms of seo... does it even matter? I'm not too concerned if someone else understands my naming conventions.
9:03 pm on May 9, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Hi mihomes, I understand you are wanting to know if class/id names in the document affect SEO, rather than discuss class/id naming conventions. That said, I'll still second g1smd's advice to name for function not form, and to use naming conventions that are intuitively obvious to others - you just never know what the future holds.

To my knowledge, as we speak there is no known connection between seo benefits and class/id names. An obvious reason would be rewarding (and therefore encouraging) multiple nested id-ed elements with multiple class names.

That would directly defeat g*'s claim to be working to improve coding standards - so I'm wondering what "changes" prompted your question.

That said, has anyone ever done any tests like:
(a) Using self-evidently unacceptable id/class names (eg, obscenities, or words that would trigger most word filters)
(b) Stuffing the :before/:after pseudo elements and styling them off the page.

Note, not suggesting these things - wondering if anyone ever tested the impact.
9:46 pm on May 9, 2012 (gmt 0)

10+ Year Member



I was simply referring to the new algo updates and what not. We all know Google is constantly changing their algo. What actually prompted the question was I had been making some changes to my css file and noticed one that I did not remember what it was for (did not describe it properly as I was probably working fast).

Of course, I realize the benefit of clean css names (it would have eliminated the above problem), but I was wondering if there was any seo benefit out of it. I have always made names as small as possible while still having a good idea what they are.
11:26 pm on May 9, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



use naming conventions that are intuitively obvious to others

Where "others" includes
:: cough-cough ::
yourself next year when you look at your code trying to figure out what it does. ("What was I thinking?")

I once processed an ebook whose creator named all his css classes in Esperanto. Let's hope no future user ever needs to edit it :)
4:20 pm on May 10, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



<focus, just SEO, just SEO . . . >

Off the top of my head the only place I can think of that ID's or classes might be relevant is in the use of microformats, and even then, only indirectly. Microformats are often used by some services (local listings come to mind) and if your site does well in those services due to proper use of microformats, then that site will likely lend you link juice that will help your overall results.
1:15 pm on May 28, 2012 (gmt 0)

5+ Year Member



I have heard rumours that Google at some point did pick up on things like id="footer", when they first started evaluating content based on page context (the 'intelligent surfer' model). But I think that their algorithms are likely sophisticated enough now to determine the relative significance of regions of a page without such cues.

However, semantic naming in markup is always a good thing in my book and is part of what HTML5 is aiming to achieve with elements like <article> and <aside>.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month