In this post I’ll briefly describe the steps I took to implement hAtom into my WordPress template.
hAtom is a draft specification for a Microformat to incorporate the common Atom format into HTML. Marking up your blog with those desciptive elements gives you several advantages but more on this later.

To make WordPress hAtom ready you have to edit the file named ‘Main Index Template’. The easiest way to do this is to go into the WordPress Admin and then to ‘Presentation’ -> ‘Theme Editor’.
This file includes the main ‘WordPress Loop’ that displays all of your posts. To add the hAtom Microformat here the only thing you have to do, is to set some HTML class attributes.

(Note: All examples taken from the “WordPress Default” template, edits are in bold)

  1. Find the div that has the id “content” and add a class “hfeed”. It’s ok for elements to have more than one class name. So if there’s already a class attribute there, just seperate them with a space. This marks the beginning of the Atom ‘feed’.
    Now it should look like this:
    <div id="content" class="narrowcolumn hfeed">
  2. Next we have to define a single entry. For this to happen I choose to include the “hentry” class to the alrady existent “post” div.
    <div class="post hentry" id="post-<?php the_ID(); ?>">
  3. To set the post title correctly I simply added a class=”entry-title” to the link surrounding the post title.
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="entry-title">
  4. Now comes the tricky part. To have a correct date format for the point of time the entry was postet we have to change the date display from the following
    <?php the_time('Y-m-d H:i') ?>;
    to
    <abbr class="published" title="<?php the_time('Y-m-d\TH:i:s\Z') ?>"><?php the_time('Y-m-d H:i') ?></abbr>
    This setting only applies if you are posting in CET. Please consult the datetime Design Patterns on the Microformats Website and the PHP date() function to adapt the part in the ‘title’ of the ‘abbr’ tag to your timezone.
  5. Now find a tag surrounding the WordPress function named the_content() (or just put a div around there) and add the class “entry-content”.
    <div class="entry entry-content">
    <?php the_content('Read the rest of the entry.'); ?>
    </div>

That’s basically it. You could of course add several more tags and classes for categories for instance. The good thing is that Microformats are nice to each other, so if you already have some Technorati tags in your blog that feature the ‘rel=”tag”‘ attribute, they will be incorporated in the hAtom format automatically.

So the question is now, how can you take advantage of your new semantic additions to your blog?
Well, as mentioned in my previous post about Microformats there is tails for Firefox but you can do all sorts of crazy stuff like converting your hAtom posts to a real Atom feed using the awesome webapp Luke Arno made: hatom2atom.
And that brings us to a whole new level. I’m asking myself why do I need a seperate feed that features the very same content that’s already displayed on my HTML pages? That’s where the magic of Microformats sets in. Their nature being that they are humans first and machines second I can now have both served just from one source.
Having Atom feeds for all of my blog posts also enables them to be used more widely for instance I can think of a few situations where an Atom feed of my archived posts could come in very handy. I’m sure you can think of several more ways to use this.

You can build a feed that contains the exact stories you are interested in from Digg.com. You can filter by: description, category, submitters, number of diggs, and number of comments.

DiggFiltr.com is a very neat page. Still under heavy development but the core feature is very useful already. I instantly created my own filtered Digg.com feed by applying a few filters on the sections I’m interested in. I can see this site getting really popular if the developer goes in the right direction with it.

One thing that I also liked was that, according to the developers blog, it only took him about 10 days to learn Ruby on Rails and develop this application which uses AJAX very extensively. Sounds like Ruby on Rails is really a good choice for rapid web development. Maybe I should kick myself into learning it finally (…if I only had time!).

Today I discovered a service called mail2RSS which converts mails you send to a predefined adress to a RSS feed. Quite handy, I have to try if it also handles multiple newsletter subscriptions and splices them to one aggregated feed.

I guess that means I can ditch my attempts to program this particular functionality in PHP, especially since I failed miserably on decoding MIME attachements like for instance pictures. I wanted this because I needed a way to display the really funny nichtlustig.de comics (sorry only in german!) in my feedreader instead of getting them in my eMail box.
What I came up with was a PHP script that reads from a specified mailbox and then constructs a new RSS item with a link to the latest comic but I wasn’t able to get the image to display properly without just focusing on one particular message format.

Well, I’ll try mail2RSS and see if it can do everything I wanted in my app.