O'Reilly logo

Programming Social Applications by Jonathan LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Microformats and the Semantic Web

A microformat is a web-based method for implementing page semantics through the use of common HTML or XHTML tags and the attributes within those tags (e.g., a <span> tag with an appropriate class). These tags convey metadata about the page or a particular object on the page.

For instance, with the defined geo microformat specification, we can use <span> tags with an appropriate class, geo, to denote that we are specifying a geographical location:

<span class="geo">
   <span class="latitude">45.512280</span>,
   <span class="longitude">-73.554390</span>
</span>

Semantic markup is a core concept of technologies such as those we explored in the Open Graph protocol in Chapter 10. Microformats are simply a way of contributing to the semantic web.

This type of semantic markup helps when you are attempting to programmatically parse a site to extract as much usable information about its content as possible. If that page has all of its relevant information tagged through microformat specifications, then extracting its relevant data should be a simple task.

In addition to providing a way to extract data easily, tagging through microformat specifications allows the site developer to denote the relevant content of the page rather than having a site parser attempt to infer that information itself. This will ensure a consistent experience when the content is integrated at another location.

There are a number of microformat specifications available to help you implement microformat ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required