In an effort to 1) bring this site up to speed and 2) learn a new skill set which will be of significant value to clients, I’ve incorporated the hAtom microformat into openswitch. w00t!
hAtom is simply this: the site feed is contained within the actual posts themselves. This is opposed to a separate feed such as openswitch.org/rss. It’s pretty cool stuff.
Microformats is a quickly developing trend on the Net which everyone involved in web design should be watching closely. But, this is old news. Chances are you’ve already heard of Microformats, if not used it yourself, so I’m not going to go evangelical on you now. What I will do is show you how I marked up my Textpattern posts with hAtom so they’re machine readable.
Here’s what I did, the process is really simple. I went and edited the form which is used when the <txp:article /> tag is called in a given page. In my case it’s the default form that I edited.
As per the specifications in the book Microformats — which Chris Harrison graciously gave to me — I marked up my default form like this:
<div class="hentry">
<h3 class="entry-title"><a href="<txp:permlink />" rel="bookmark"><txp:title /></a></h3>
<div class="entry-date"><abbr class="updated published" title="<txp:posted format="%Y%m%d" />"><txp:posted /></abbr></div>
<div class="entry-content">
<txp:body />
</div>
<div class="comments-invite">
<txp:comments_invite />
</div>
<div class="cats">
Filed under: <txp:category1 link="1" section="journal" />
</div>
<span class="vcard author"><a href="http://openswitch.org" rel="me" class="fn url"><txp:author /></a></span>
</div>
I’ve added in some spacing so you can see the divisions within the markup.
In order to write hAtom into your markup correctly you need four elements: the Root Element, the Entry-Title, the Updated/Published, and the Author.
The root element is this:
<div class="hfeed">
<div class="hentry">
Note that the hfeed class only has to be present once per page. Then the hentry class has to be wrapped around each individual post.
The entry title is written as an h3 tag:
<h3 class="entry-title"><txp:title /></h3>
The updated/published element is a combination of two microformats: the published date and the last updated date. But since with a blog these dates are (usually) the same it’s OK to combine them:
<abbr class="updated published" title="<txp:posted format="%Y%m%d" />"><txp:posted /></abbr>
The author element is included in all my posts but you’ll never see it unless you view the page source because it’s set to display:none; in the CSS:
<span class="vcard author"><a href="http://openswitch.org" rel="me" class="fn url"><txp:author /></a></span>
So that’s it. Now, if you’re running Textpattern you need to go implement hAtom into your blog.





