31 December 2006

Blogger Beta and XHTML, a no go?

One of the things that had plagued us during the time of the old Blogger was the invalid mark-up that Blogger forced us to use so that it could work. When Blogger Beta was announced, this was one of the things that I had genuinely thought could be worked around. When I saw the new template language of Blogger, relying on a more XML based structure, and the errors it asked us to constantly check before we could preview or save our pages Most of them are tag nesting or Blogger Layout tags gone awry. Seems like a start to making Blogger pages more XHTML valid. It still doesn't catch inline styles (not allowed in XHTML) and wrong use of data tags, which could save us hours of head banging later on if you plan to make the switch to XHTML., I was happy that now we could have well formed XHTML Not that it is a prerequisite, but keeping in the mind the various uses and advantages, it is always good to stick to something a application is looking to receive, rather than give it a jumbled up mark up to sort through first. valid templates.

Unfortunately, that's not been the case.

For whom the bell tolls

I had done some serious testing of Blogger templates (both default and custom made) for a hack that I have been developing, and the results were pretty bad. None of them strictly adhere to the standards, and many give multiple errors. I know for a fact that their can be no 'perfect' check to test our templates, since they contain practically all data (scripts/style/mark-up) in one place, but some level of standard (better than the current one) should be enforced by Blogger's template editor. The reason I blame Blogger a bit apart from people is because many of the things Blogger auto-inserts (like the Navbar) don't follow XHTML standards, and you can't do anything about it. You can't remove it, and hiding doesn't make a difference since the code is still there. It is in the long run that having well formed HTML, and even a valid XHTML mark-up will show its advantages. What advantages you ask?



To begin with, because XHTML follows the guidelines of XML, it becomes much easier to work with them in other applications other than a web browser like search engines. RSS feeds are plain XML, and see how useful they are. Extend them to web pages, and you can imagine how much more functional they become. They become more 'accessible', and easier to understand for programming languages. It also enforces clean coding habits, which improves readability and correcting. XHTML demands the seperation of style from content, hence no inline styles to be used if you want your document to be valid. W3C lists the main advantages as:

Extensibility: As an XML application, XHTML is extensible by definition. This makes future changes to the language much simpler in comparison to the process of changing HTML. Most browsers are already XML-compliant, so adding elements to the language is simply a matter of changing the document type definition and namespace. It's no longer necessary to wait for browser developers to implement support for new elements.

Interoperability and portability: A properly structured XHTML document can be reformatted for use on a variety of display devices, including cell phones, PDAs, and other handheld devices. An XHTML document is also interoperable with other XML tools and applications.

So how does one start making their templates XHTML valid? Well, there are some rules to be followed. It is not a 'whole new language' and the rules aren't that different from what you have been following with HTML, just more strict. For example, values for attributes must be put in quotes, like color="#FF0000", and no colour names. Empty tags (like br and hr) should be implicitly closed by putting a forward slash before the angular bracket like <br />, and so on. For a complete list, you can refer to W3C's documentation, but a brief beginner's list can be found here.

Following standards isn't hard at all, just takes a little bit of effort. Other platforms like Wordpress and Expression Engine do offer a higher level of standard strictness by formatting posts and comments automatically, which Blogger has yet to equal. Blogger should help us tidy up our work more than it does at the moment, and Blogger users/template designers should try to keep this in mind and stick with a 'more' valid mark-up. It'll ensure that your pages and designs survive longer, and are more functional/usable in the long run.

Now if only someone from Blogger were to read this, they could do something about it!


Microformats - the next big thing in automatic content recognition and relation, is majorly helped by proper systematic and semantic HTML, or XHTML. Suppose you have added the contact information of someone you blogged about. Any of the microformat recognition extensions (Tails, Operator) will recognise the relevant details if the details are semantically marked-up, and offer you quick links to save them if you choose to. Map locations to whatever application you use for maps, contact information to your contact list, and so on! Cool, ain't it? Here's a good starting point if you want to know more!


0 comments