Sunday, April 01, 2007

My adventure with microformats on rails

My adventure with microformats on rails:

So after listening to all of the SXSW podcast I decided that I need to try something new namely microformats they seem like such a cool piece of tech and I wanted in on it too. I started looking around at these weird little things called microformats. I found out that they were just a simple little XHTML snippets but there is a standard of markup, I won't go into to much detail about that so for my contact info I would mark it up like such:


<div id="hcard-Chris-S.-Maness" class="vcard">
<span class="fn n">
<span class="given-name">Chris</span>
<span class="additional-name">S.</span>
<span class="family-name">Maness</span>
</span>
<a class="email" href="mailto:chrisprayingmantis@yahoo.com">chrisprayingmantis@yahoo.com</a>
<div class="adr">
<div class="street-address">Maness Hollow Ln.</div>
<span class="locality">Blackwater</span> ,
<span class="region">VA</span> ,
<span class="postal-code">24221</span>
<span class="country-name">USA</span>
</div>
<div class="tel">+1 555 999 2002</div>
<a class="url" href="aim:goim?screenname=prayingmantis207">AIM</a>
<a class="url" href="ymsgr:sendIM?chrisprayingmantis">YIM</a>
</div>


Now this is just a standard way of marking up the data that you already have inside of your site so that other applications can accessing your data easier. So adding it into your site is so easy I don't see why we couldn't start building this stuff right in from the start. Now I've got you wondering "Which applications can use these pieces data?" as of right now there are not to many apps that can use that have been developed yet (that I know of). Technorati is one of these few apps that searches blogs and looks for microformats in the process. Just having these microformats in there gives us a ton of functionality to use. Speaking of that let us take a look at a rails plugin that helps us to read these little pieces of information.

As you all may know I am a ruby on rails fanatic and I'm always ready to try something new. So I started looking around the net for a ruby gem or a ruby plugin that could read microformats , lo and behold I stumbled ac ross this plugin for rails called mofo (what a horrible pun). So I decide to take a look at it, and I've got to say it works pretty good but not as well as I would like it to, the only thing it won't do so far is read tags off of your own rails app (I found that little odd but I can work with that.). So all in all this looks really good so far. I'll keep looking for more interesting stuff for my next post.