Microdata: HTML5’s Best-Kept Secret
webmonkey.com
webmonkey.com
I've always been a proponent of placing all data in a script using json which you can consume easily without screen scraping.
And it seems to me that in real world web apps all the markup with microdata could be programmtically added. Create a new object with a microdata schema and get an ORM type object with an HTML write method. This way you never manually type microdata markup anyways.
<div>
<h1>Hendershot's Coffee Bar</h1>
<p>1560 Oglethorpe Ave, Athens, GA</p>
</div>
Into <div itemscope itemtype="http://data-vocabulary.org/Organization">
<h1 itemprop="name">Hendershot's Coffee Bar</h1>
<p itemprop="address" itemscope itemtype="http://data-vocabulary.org/Address">
<span itemprop="street-address">1560 Oglethorpe Ave</span>,
<span itemprop="locality">Athens</span>,
<span itemprop="region">GA</span>.
</p>
</div>
...is not markup pollution? It's three times as big as before, and the value of this is still questionable.If I’m writing some text by hand, I’m going to use markdown and just write:
# Hendershot’s Coffee Bar
1560 Oglethorpe Ave, Athens, GA
As for the benefits: having some widely-used machine-readable metadata linked directly to the data could let browsers do some pretty neat stuff in the future, like letting a user click to add an event to his calendar, look up directions to an address, or add a person to his contact book.Edit: Perhaps that risk could be mitigated by having the human-readable markup issue a JS call to the data island, which would have the benefit of being DRY-compliant.
<script data>
bizcard={
name: 'Hendershot's Coffee Bar',
address :{
line :'1560 Oglethorpe Ave',
city :'Athens',
state :'GA',
zipcode:'30606',
country:'US'
}
};
</script>
<div>
<h3><span data="bizcard.fname"></span></h1>
<span data="bizcard.address.line"></span>
<span data="bizcard.address.city"></span>
<span data="bizcard.address.state"></span>
</div>
Which also won't work for people with javascript disabled. Plus, does Google go through your javascript and figure out what eventually makes it onto the page?The idea of the data island is to have the data separated from the content and let consumers use the data whenever they need it. I am now studying the possibility to use a link tag and have the data island external, like rss/atom to save bandwidth when 90% of consumers won't care about the data. And for those who care, they just load the external link and there you have it, all the data without scraping.
They're the URLs you see on Facebook that have #! in them.
Zero pollution
Zero overhead
Markup/style/data separation
http://www.google.com/support/webmasters/bin/answer.py?answe...
If a web app creates dynamic data at URL: http://example.com/stockfeeds?symbol=APPL then perhaps use something like: http://example.com/stockfeeds.n3?symbol=APPL to get RDF. Also, have standard (or commonly used) meta data to point to an equivalent RDF URI in generated HTML.