Valid HTML and RSS despite the CMS!

[Disclaimer: I've made further changes to the web site since this article was written, so the implementation is no longer guaranteed to reflect what's described here. I was going to delete this article, but decided against it, as the information here may be useful to other users of CityDesk]

It wasn't easy, but I got there in the end.

In the latest re-work of the site, I (a non-programmer) have been trying to tidy up my code somewhat.

This included implementing a menu functionality, that works even if Java Script is disallowed by the user and a bunch of other "no script" alternatives.

I also abandoned tables, which are an inherent part of the telepark Vantaa template.

Then I decided to go for code validation :-)

You've got to realise that my knowledge of HTML is based on what I've learnt from "googling" the web to get answers to specific problems and by liberal use of Ctrl+U in Firefox (View Source) whenever I find something I like.

So the first problem was to determine what standard you're trying to adhere too. I took the pragmatic approach. I used the W3C Validator at http://validator.w3.org/ and validated a sample page against various standards, until I found one that returned a reasonable number of errors that - and this is the important bit - I felt I could fix.

Then is was just a question of working though the errors, one by one. Some were a bit tricky, because my CMS (CityDesk) does a few funny insertions of its own accord, when you switch between the HTML and the Normal views of an article.

However, one problem took a bit more effort. CityDesk inserts its own credits (which is fine by me) into the HTML <head>, using XHTML 1.0 syntax (i.e. with a space-slash " /" closing the meta definition). Needless to remark, there is no way for a normal human to get at the offending bit of code/text to fix it. Careful investigation however, showed that the insertion was being triggered by the <title> tag.

How about this for a workaround? [Thanks to Richard Wood for the underlying idea, here: http://discuss.fogcreek.com/CityDesk/default.asp?cmd=show&ixPost=8682)

<!-- The comment immediately below comments out the non- HTML 4.01 Transitional syntax in the CityDesk credits. Sorry.-->
<title>Page Title here, using CityDesk variables</title>

The resulting source code looks like this, after CityDesk has been fooled into thinking that the commented-out title is the insertion point for its credits:
<!-- The comment immediately below comments out the non- HTML 4.01 Transitional syntax in the CityDesk credits. Sorry.--> <!--<head><meta name="generator" content="Fog Creek CityDesk 2.0.25" /> <meta name="citydesk" content="524006F6/452" /> <title></title>--> <head>
... <title>Welcome to Colm Toolan's world of Business Architecture! | Colm Toolan, Business Architect</title>

"Valid HTML 4.01" logoBecause the offending syntax is now included only as a comment, the validation of the sample page produced the much coveted result shown here.  

The RSS feed was more or less without problems, although CityDesk does sometimes insert some funny effects, which are difficult to find because there's no HTML view of the teaser text in the article template. Also, some of the things that are allowed in the HTML 4.01 compliant web page are not allowable in XML - the <strong> tag for instance. So it may be that there will occasionally be problems, as I add pages.

"Valid RSS" logoBut, in the meantime, here's another coveted logo.


Valid CSS! P.S.13th August 2007: Continuing the good news, I can now tell you that the style sheets used to drive the screen presentation and the print layout - http://www.toolan.de/admin/stylesheet/CSS_1.css and http://www.toolan.de/admin/stylesheet/CSS_1_Print.css respectively - have both been successfully tested.

Mighty pleased with myself, I am!

del.icio.us  Digg It! furl  Google Bookmarks  Netscape  Reddit SlashDot  Sphere  Spurl StumbleUpon  technocrati Windows Live  Mr. Wong  Yahoo MyWeb
Tools | toolan.de

Recommend    Comment