Real World Embedded Metadata – RDFa, Microformats And Microdata Practical Examples

Have you ever seen those small grey descriptions in Google search results below the title? If you’re curious on how to get them, then the answer is embedded metadata.

With the words embedded metadata we refer to a way to add invisible information in an HTML/XHTML document. These informations will be machine readable, by Google or Yahoo for example, but will not be seen in the browser. Basically we’re going to add some properties to our HTML elements that will say to Google: “Hey, this h1 title is my name, and this h2 title is my work title, I’m a web developer“. As a result Google will show in the search results, under our page title, a little line with our name and our work title.

Google embedded metadata Results

There are three main embedded metadata specifications that are struggling to become a standard, and probably none of them will be 100% standard like it’s happening with HTML5, so it’s better to have a basic understanding of how all of them work. The projects are:

  • RDFa: a specification strictly connected with XHTML, supported with the XHTML1.1 doctype
  • Microformats: the most diffused specification till the arrive of HTML5
  • Microdata: the HTML5 specific set of instructions.

The history of the formats shows how RDFa started the topic, basing everything on the Resource Description Framework; it’s complex but well supported.

Then arrived Microformats, with his friendly structure and became very popular. With HTML5, the group decided to create his own version of interconnected information organization. Let’s avoid asking if we really needed another specification for this standard, and let’s start seeing some example on how enrich our HTML with a machine readable representation of data.

We’re going to see how the three different standards can be used to represent our name and our work title, in a typical about me page. These informations could be added to google search results and every future applications that will use embedded metadata.


Let’s start with an RDFa example:

	<div xmlns:v="" typeof="v:Person">
		<p>Name: <span property="v:name">Marco Lisci</span></p>
		<p>Title: <span property="v:title">Web Developer</span></p>

First of all RDFa needs a proper name space when working with it, to avoid conflicts in the XML tree. So we’re going to add the xml schema, with xmlns:v=””, the official Google RDF schema. Then we have to declare the type of what our informations are going to represent, in this case a Person adding typeof=”v:Person”.

If you look at the documentation, there are a lot of other types that can be used, according to our needs. Then, using the v root, we’re going to add the properties to our span elements. Using v:name, we’re telling to the system that will read our page that what’s inside the span is the name of the person we want to represent. And the v:title will be read as the title of the current person. As you can see, you’re not breaking the XHTML, it’s about adding some little properties that can be really useful. You can find the entire specification on the W3 website.


Microformats are far simpler that RDFa. The reason is clear, there’s no need to specify an xml schema and use properties. It’s all about using special names in classes. So our previous example will be:

	<div class="vcard">
		<p>Name: <span class="fn">Marco Lisci</span></p>
		<p>Title: <span class="title">Web Developer</span></p>

Yes, it’s really so simple. Just add the class vCard to the wrapper element, and add fn to the name span element (the fn is the only required class), and title to the work title span element. This is the representation of hCard microformat element. By doing this, Google and other softwares will be able to grab the info and use them.

There are a lot of other elements that you can use to enrich your hCard representation, all listed at the official hCard page. There’s also an hCard creator, a little form to create an hCard representation from your info. I think that Microformats are really great, but if you’re following the HTML5 train, you can’t miss microdata.


Microdata are the Microformats for HTML5. and this spec has it’s own DOM API, so it could become the standard when HTML5 will be widely spread. We can already start using it since Google announced microdata support. So, let’s take a look at how it works:

	<div itemscope itemtype="">
		 <p>Name: <span itemprop="name">Marco Lisci</span></p>
		 <p>Title: <span itemprop="title">Web Developer</span></p>

You can see more than one similarity with RDFa. Also in this case you have to add a data vocabulary with itemtype. We used again the official Google vocabulary for microdata. The other important thing is to add itemscope to the wrapper element of all your informations. Then with itemprop we can assign to our spans the name and title values. It’s a little bit complex compared to Microformats, but could become the standard.

Useful links.

When you’ll get a little confidence with these three standards you’ll want to add more and more infos to your pages. Every one of these standards has schemas and properties for the most common informations used on the web, even nested elements, but they’ll follow the simple structure described here. The official specification page of RDFa is at the W3 website, it’s a little bit complex, but useful to understand deeply the Resource Description Framework.

There’s also the Microformats Wiki, and it’s the project with the best documentation among the three. Then there’s the microdata specification.

Remember that all of them are Google ready, so pick one and start experimenting! I personally use Microformats, but I’ll switch to HTML5 Microdata if it will show a solid foundation.

Your Turn To Talk

I hope you found this article useful. Please feel free to chime in by leaving a comment below! ;)


  1. says

    Hi Marco,

    My name is Manu Sporny – I’m currently one of the Chairs of the RDFa Working Group and have also been very heavily involved in the Microformats community over the years. There are a couple of issues with the article that I wanted to highlight, perhaps you could correct them?

    Microformats don’t refer to RDFa or Microdata – Microformats are their own thing. One could think of all of this stuff as Microformats, but it really confuses people when you say that RDFa is both a Microformat and RDFa. Strictly speaking, Microformats are not RDFa. Microformats are not Microdata. Each has its own language syntax.

    RDFa is not only defined for XHTML, but it is also being defined for HTML5 and HTML4.01. RDFa will soon be available for all major HTML languages used on the Web today:

    Your examples seem to be a bit off – the RDFa example should be:

    <div xmlns:v=”” typeof=”v:Person”>
    <p>Name: <span property=”v:name”>Marco Lisci</span></p>
    <p>Title: <span property=”v:title”>Web Developer</span></p>

    Your Microformats example should be:

    <div class=”vcard”>
    <p>Name: <span class=”fn”>Marco Lisci</span></p>
    <p>Title: <span class=”title”>Web Developer</span></p>

    Your Microdata example should be:

    <div itemscope itemtype=””>
    <p>Name: <span itemprop=”name”>Marco Lisci</span></p>
    <p>Title: <span itemprop=”title”>Web Developer</span></p>

    Other than those minor issues, good story. :)

  2. says

    @Manu: Thank you so much for your comment, very helpful ;)
    We updated the post to reflect your comment and fixed a little problem with our code highlighter plugin. Thanks!

  3. says

    Also note that with the new RDFa 1.1 stuff, you can achieve markup that is just as simple as Microdata (via the @vocab attribute) and Microformats (via RDFa Profiles). The following example demonstrates how you can use @vocab in RDFa 1.1:

    <div vocab=”” typeof=”Person”>
    <p>Name: <span property=”name”>Marco Lisci</span></p>
    <p>Title: <span property=”title”>Web Developer</span></p>

  4. says

    Interesting stuff, I have only experimented with microformats.

    Recently I rewrote my resume ( with microformats: hCard, hResume (which uses hCalendar as well) and html5.

    There were a few semantic issues, like hCalendar not allowing the usage of the html5 time element. But in the end it came out pretty well.

    One thing that’s easy to miss from the microformats wiki is that, if I understand correctly, you should declare which microformat profile you use, like or in a meta tag.

    One thing that I found useful is checking your embedded metadata with Google’s rich snippet tool (

    Anyway, I might have a look at microdata or RDFa with html some time soon. Thanks for the article

  5. teebee says

    FYI: The code block under “Microdata” has an error. “itemscope” in the div block isn’t quite there!

  6. says

    great article, but I have one question. How can you build an onsite search engine using these languages? For example to search people that are web developers?


  1. Real World Microformats – RDFa, Microformats And Microdata Practical Examples…

    Have you ever seen those small grey descriptions in Google search results below the title? If you’re curious on how to get them, then the answer is microformats….

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *