Archive for August 24th, 2007

A Little Hypertext with Your Markup?

Friday, August 24th, 2007

I have worked on countless projects over my career with varying levels of code quality. One thing that always causes me grief is overdone code. By that I mean cases where a simple solution is all that is required but some overzealous developer adds five nested tables with nine out of ten cells being empty, uses span tags everywhere, chaotic sceneand lets not forget, inline styles on everything. I’m all for fast results but I don’t think the “as long as it looks OK, go with it” rule applies in this case.

Not only does this add unnecessary size to the project and makes changes ten times harder, it also hurts SEO scores as well. No, I’m not saying that your friendly neighborhood GoogleBot is easily confused, but it does effectively dilute the weight of your text. In most cases, the “stuff” that you want bots to use to rank your site is the raw text. Yes, I understand that formatting this text is important by using h1 tags, font sizes, etc but there is also a visible-to-hidden content ratio that most bots consider. If you have 4 lines of text to display, 400 lines of formatting will cause that text to have less weight and relavancy than using 40 lines of formatting.

Proper use of CSS can greatly reduce the amount of markup on each page. However, everything can be used to much so I try to practice a less is more approach. confusing codeIf you can achieve the same result without an image, whats the point in using and image? I am not at all against the proper use of tables but if you can achieve the same result without them, then take the simpler approach. The point is to achieve the result that you want in the most efficient and to-the-point way possible. Not only is this good, clean coding, its also a solid approach to web 2.0.

Another point I can’t stress enough is adherence to W3 standards. I’ve dealt with people who have no regard for any type of web standards and not only was editing their work a headache, it was also a huge roadblock to SEO. cood codeThere might be other opinions on this out there but I can tell you that working side by side with very similar projects, one with terrible W3 standards and the other with perfect conformity. The latter appeared at the top of many of our targeted searches, gained PageRank twice as fast, and was indexed faster than the other. The project with poor conformity also stalled at a specific PageRank even though it now has twice the traffic and ten times the inbound links than the other project. I imagine its still there with the same PageRank.

“But what coding standard should I choose? HTML 4.01, xHTML?”

My experience has been that even though its painful to convert larger projects, xHTML 1.0 Strict has worked extremely well for me. If you are dealing with a great deal of legacy code, xHTML 1.0 Transitional might make your life a little easier. While Adhering to any standard is better than nothing, xHTML is basically well-formed HTML and its going to become necessary at some point to make the switch so why not start now.

Everyone loves WordPress and its tendency to get eaten up by search engines. Most of the advice I have in this post is put into practice by WordPress. Its not definitive proof that I know what I’m talking about but I think most of you would agree it all makes sense. I know this isn’t news to a lot of you that have been doing this for a while now but I am amazed to see the amount of disregard for coding standards out there. A syntax error wouldn’t slide in a conventional application so why does it happen so much with ML?

Close
E-mail It