266 Chapter 11—Microdata
11.1.2 The “itemtype” Attribute
We do not have far to go during our search for standardized dialects. The WHAT-
WG’s Microdata specification already contains three of them: vCard for contact
information, vEvents for dates of events, and a third one for specifying licenses
of a work. A multitude of other dialects can be found in the microformats com-
munity at http://microformats.org. But in contrast to microdata, these dialects
are defined in the microformats scheme, making lavish use of class and rel at-
tributes for determining metadata structure.
With the attribute itemtype, you determine that the existing microdata follows a
standardized vocabulary. As an attribute value, itemtype expects a URL for the
corresponding standard. vCard and vEvent reflect the close link between micro-
data and microformats, because both profiles in the specification refer directly
to microformats.org:
z http://microformats.org/profile/hcard
z http://microformats.org/profile/hcalendar#vevent
Let’s try to code a vEvent for the concert in our blog entry. We need to add the
correct itemtype and then specify the itemprop attributes in accordance with the
hCalendar specification:
<article itemscope
itemtype=http://microformats.org/profile/hcalendar#vevent>
<time itemprop=dtstart
datetime="2010-10-09T20:30:00-04:00">
Saturday, October 9th 2010, just before half past eight in the
evening
</time> ...
<span itemprop=location>Community Theater</span> in
<span itemprop=location>Morristown, NJ</span>...
<span itemprop=summary>Orchestrion</span> ...
</article>
If we copy this microdata fragment into the microdata viewer, we can see an-
other output option next to the JSON notation, this time in iCal format, which
could be seamlessly imported into your own calendar:
BEGIN:VCALENDAR
PRODID:jQuery Microdata
VERSION:2.0
BEGIN:VEVENT
DTSTAMP;VALUE=DATE-TIME:20101227T205755Z
DTSTART;VALUE=DATE-TIME:20101009T2030000400
LOCATION:Community Theater
LOCATION:Morristown\, NJ