A couple of days ago I saw one of Garry Conn's posts related to tips about image positioning in a post. One issue that I expressed my opinion on was the fact that the ID attribute of an element needs to be unique on a web page. This is due to the fact that the page will not validate otherwise. Garry replied that he is not at all worried about validation issues, because they are irrelevant to SEO (Search Engine Optimization). What this means is that no matter how many errors a web page has, it will still be indexed and displayed in Search Engines as long as the bots can crawl it's content. I'm sure he's right about this and it's every webmasters choice if he should care about validation or not.
But that's not the reason behind this post. Garry also pointed out that this blog, my beloved "The Yoboo", was also not validating according to the W3C validator. In fact, the homepage had more than 400 errors. That disturbed a little because I'm one of those guys that do care about validation. And with that in mind I set off to fix things.
The first issue I encountered was the fact that this template used a XHTML Strict DOCTYPE. As stated on A List Apart: "a DOCTYPE (short for "document type declaration") informs the validator which version of (X)HTML you're using, and must appear at the very top of every web page. DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate without them." Many of the errors were triggered by the fact that the template used an Strict DOCTYPE, rather than a Transitional one. Another way to say this would be: is was formatted as a Transitional XHTML, but declared a Strict DOCTYPE. No problem. This was easily fixed replacing the original declaration with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
That apparently solved a lot of the validation errors. Now I was down to about 70 remaining. I started to fix the ones that repeated the most. One of them was "document type does not allow element 'p' here". This was caused by the fact that the body of a single post was defined by a P element(paragraph). And inside this paragraph there were several others which represented the header of the post, the content of the post and it's footer. According to the W3C standards, this was an error, so for a easy fix I replaced inside the template the paragraph elements with DIVs. I replaced the sections of the post also because I plan to use standard formatting in the future, rather that the way Blogger does things (I'm talking about the <BR> tags for separating paragraphs). So I also went to Settings in the Blogger Dashboard and under Formatting I've set the "Convert line breaks" option to "No". This of course means that I will need now to reedit all the posts and split them up in paragraphs. I'll do that some day.
After these modification there were only about 30 errors remaining. The problem with these is the fact that they're caused by the Blogspot engine itself. Due to some bad and reckless coding I had a lot of unescaped &'s. Most of them were caused by the blog Pager, the little thing that helps you get back and forward through posts. Because I wanted to get rid of all the errors, at least the ones on the front page, I commented the pager so it will not appear anymore. I'll decide if I'll place it back on the blog. Maybe by the time I do that, it will be valid XHTML.
A few more errors were caused by the fact that the Blog Achive was displayed using Hierarchy style. Switching that to "Flat List" solved the remaining of the errors so the homepage was validating. But I rather liked the Hierarchy style of displaying the archive so I hope that will be fixed as well.
After seeing the beautiful green bar I tried a few more things to make sure there are no more errors, but there were. Another issue arises with the fact that I've opted for inline comments. This creates an IFRAME element which again trows unescaped characters errors. But since I find this feature very useful, I'll let it pass.
And that's the way I managed to validate most of "The Yoboo". Who would have thought that a Blogger/Blogspot template would have so many problems? Of course there are other people that are complaining about these issues, but it seems there is no one there to listen to them. Oh well, at least my blog has the green light to some extent.