Tuesday, June 26, 2007

Why Valid Code May Be More Important Than You Think

Testing your web pages in browsers is an absolutely necessary process for building any web page. It allows you to see what others can see, and often you will notice mistakes in your HTML code because of the symptoms they cause in browsers. But what about when your testing browser(s) display the pages exactly as you intended. Are your pages error-free? Not necessarily.

The World Wide Web Consortium (W3C) sets the standards for coding HTML and CSS for web pages. They also provide tools to validate your code for free. So do some third-parties. The question you might be asking is, "if my page looks fine in Internet Explorer, Netscape, Safari, Firefox, etc. why do I need to worry about validation?" If all you're looking is for proper display, you might not have to. However, if you're concerned at all with search engine optimization (SEO), and you probably should be, validating your source code is a necessity.

One reason for this is the difference between search engine spiders and browsers. Spiders "crawl" the web indexing web pages and their content. They are basically toned-down web browsers that aren't concerned with displaying for a user but with recognizing content. In other words, search engine spiders are looking at the same code your web browser is and parsing it in a very similar way. This difference in functionality, however, is vast.

There is a very real pressure on web browser developers to ensure that their browsers display pages correctly to the user. This often includes forgiving errors in the source code. Improperly nested elements, unclosed tags, unrecognized parameters - these are all errors in HTML code that might not affect your web page's display in your favorite browser. When it comes to search engine spiders, however, it can be an entirely different story.

That is not to say that small errors in your HTML code will spell death for your search engine rankings. Certainly they won't normally make your page invisible to spiders. They can, however, disrupt the vastly important process of a spider parsing your page for all relevant content or make some of that content invisible. And since so much of SEO is paying close attention to every little detail of your site and its content, why leave the possibility open of causing problems for search engines when they try to index your pages?

Validation might mean some big headaches when you set out to fix every last error on your pages, but the benefits of valid code are clear - and running your pages through a validation service like that of the W3C can do a lot in the way of educating you about the mistakes you may be making.

No comments: