Skip to content. | Skip to navigation

Sections
Personal tools
What is this?
Hi, my name is Tom Lazar and I'm a Plone and Zope developer based in Berlin, Germany and this is my personal and professional (no big difference, really...) website.
 

How to make COREBlog's RDF validate

Filed Under:

From the Ministry of Standards Compliance

Once I was into fiddling with the RSS-Feed of COREBlog I thought, I'd might as well finish it through and make it validate, too... Another thing I wanted to fix, was that the default feed only contained an excerpt of the entry (essentially a truncated, non-html version of the main entry) and that I wanted to supply a full-blown version of my entries via RSS (this way folks won't need to leave the comfort of their feed-reader, which is, of course, what feed-readers are all about, anyway...)

Let's start with the validity first: turns out, the only obstacle remaining (after my first spring-cleaning) was the format of the <dc:date> entries: they weren't W3C-conform... tststs...

Since I still know next to nothing about Python I started googling for quick answers on how to format the output of ZopeTime. Here's the answer, for your convenience: in the rdf10_xml object of your COREBlog instance replace the occurrences of ZopeTime resp. ZopeTime(created) with <dtml-var "ZopeTime().strftime('%Y-%m-%dT%H:%M:%S+01:00')"> resp. <dtml-var "ZopeTime(created).strftime('%Y-%m-%dT%H:%M:%S+01:00')"> (adjust the +01:00 bit at the end for your timezone). Volia!

On to the body contents. Too lazy to read the actual damn specs, I simply checked the RSS feed of a blog that uses HTML extensively and lo-and-behold! there's a CDATA block. Hmm.. I can do that, too... Let's see:

Step One: Again, in your rdf10_xml replace <description><dtml-var excerpt></description> with <description><![CDATA[<dtml-var body>]]></description>.

Step Two: There is no step two ;-)

Update: After boasting my latest achievements in the COREBlog-RSS-Department to co-hacker, friend and Honourable Knight of the Holy Order of Webstandards Compliance Tim during an early morning iChat session I soon realized, that perhaps one should read the specs afterall... Or, faling that, at the very least, you should know somebody like Tim ;-)

So while my first efforts were all well and fine, they weren't quite sufficent. Here's a list of remaining shortcomings along with their solutions (all located in rdf10_xml):

  • The feed-description contains the text 'A Zope Weblog product': it should contain the 'about' entry, i.e. <description><dtml-var blog_long_description></description>
  • The original template leaves the creator element empty. Why not use this? <dc:creator><dtml-var author_profile></dc:creator>
  • According to the spec, the <description> element does not allow for any HTML-tags. rather, for delivering the full body it specifies the <content:encoded> tag. So, we revert the description back to the excerpt and add an <content:encoded> element with the CDATA-bit. (don't forget to add a xmlns-entry for content!) And while we're at it, why not throw in the subtitle for good measure? Thus, we have this: <description><dtml-var excerpt></description><content:encoded><![CDATA[<p><b><dtml-var subtitle></b></p><dtml-var body>]]></content:encoded>

Now, all that remains, is the <dc:subject> issue: currently, it only contains a numeric index to the categories (i.e. [4,7]) rather than the actual text (i.e. "Blogging, Geek"), but I think, I'll leave that to Atsushi Shibata ;-)

For anybody interested, I have posted my entire rdf10_xml into the extended section of this entry. I hope you'll find it useful. See you in your favourite RSS-Feedreader!

Re: How to make COREBlog's RDF validate

Posted by erral at Feb 02, 2005 04:51 PM

We did something similar with in this way: