Alex headshot

AlBlue’s Blog

Macs, Modularity and More

Playing nice: my blog is now XHTML compliant

2005

It took me some time, but I've now ensured that my blog is XHTML 1.0 compliant. What is perhaps surprising that it took so long; I've been careful to write well-formed XHTML as I've been writing my blog as I've gone along. However, I wasn't always perfect, and so I had to fix a number of errors.

  1. Getting the blog template XHTML compliant. This isn't as easy as it sounds, because the template itself contains meta-instructions to Blogger to insert the appropriate title, hide/show comments and the like. Firstly, I had to get the DIVs sorted out so that it was well-formed XML, and then experiment with the validator to ensure that both the main index page and post pages were correctly generated.

  2. Fixing required elements and attributes. XHTML requires certain elements that HTML does not mandate; for example, every page must have a HEAD (including TITLE) and BODY elements. Also, IMG requires an ALT tag as part of XHTML, which is a pretty good idea IMHO.

  3. Getting a few tags the right way around. Especially nested tables, which always seemed to cause a headache.

  4. Ensuring that stuff like OL, UL and PRE weren't enclosed within a P element. This seems to be true of Maven's XDoc SOURCE element as well, since that's rendered as its own DIV.

  5. Making sure that all the URLs that I link to look like http://www.example.com/?stuff=&other= instead of http://www.example.com/?stuff=&other=

After all that, the blog is now XHTML compliant. (And, since the main index page contains all the posts (in the last year), it means that it's easy to check whether all posts are XHTML compliant.) The only problem is that comments appear to be non-XHTML compliant; probably partially due to not having fixed the template, but also because anyone who makes a comment can insert non-XHTML code.

It would also be CSS compliant, if it weren't for the fact that Blogger sticks a non-standard CSS file which is non-changeable ...