An atomic WordPress

Recently I’ve been playing around with Microformats, more specifically hAtom.

As an experiment, I converted this sites feed to a dynamically generated microformat based feed. After doing some reading I came across this little gem, hAtom2Atom, this is where the fun began. I added in the necessary class declarations to my theme according to the hAtom specification and then it was time to get the ball rolling. To speed things up, I found this little script, which provided me with everything I needed to get this operational.

With a few edits here and there, all I had to do was upload the XSL files, accompanied with the script I mentioned above, and edit the RSS line in my theme header to look like this:

<link rel=”alternate” type=”application/atom+xml” title=”<?php bloginfo(‘name’); ?> Atom Feed” href=”/hatom2atom.php<?php echo $_SERVER[‘REQUEST_URI’]; ?>” />

The results exceeded my expectations, not only does it work for my main feed, but if I wanted to generate any sub-feeds (i.e. a feed for all posts tagged with WordPress) they were covered. All I had to do was subscribe to http://tgardner.net/hatom2atom.php/path/to/whatever/, and I’m sure with a little mod-rewrite I could pretty up the URL a bit. If you’re using a feed reader you can leave out the hatom2atom.php and it will automatically be inserted using the alternate link in the header (i.e. you can subscribe to http://tgardner.net/).

If you want to try this for yourself I threw together a zip of all of the files I needed. Just extract them to the root of your WordPress install and modify the header in your theme like above.

Happy microformatting!

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.