Microdata (HTML): Difference between revisions

Content deleted Content added
m v2.01 - WP:WCW project (Multiple categories on one line - Reference before punctuation)
No edit summary
Tag: section blanking
Line 20:
* <code>itemref</code> – Properties that are not descendants of the element with the <code>itemscope</code> attribute can be associated with the item using this attribute. Provides a list of element ids (not <code>itemid</code>s) with additional properties elsewhere in the document.<ref name="WHATWG"/>
* <code>datetime</code> - Indicates date or duration as specified by [[ISO 8601]] standard.
 
== Example ==
The following HTML5 markup may be found on a typical “About” page containing information about a person:
 
<source lang=html5>
<section> Hello, my name is John Doe, I am a graduate research assistant at
the University of Dreams.
My friends call me Johnny.
You can visit my homepage at <a href="http://www.JohnnyD.com">www.JohnnyD.com</a>.
I live at 1234 Peach Drive, Warner Robins, Georgia.</section>
</source>
 
Here is the same markup with added [[Schema.org]]<ref>{{cite web|url=http://schema.org/docs/documents.html |title=Documentation |publisher=Schema.org |date= |accessdate=2016-06-30}}</ref><ref>{{cite web|url=http://schema.org/docs/full.html |title=Type Hierarchy |publisher=Schema.org |date= |accessdate=2016-06-30}}</ref><ref>[http://schema.rdfs.org/all.ttl Schema.org Turtle RDFS Schema]</ref> Microdata:
 
<source lang=html5>
<section itemscope itemtype="http://schema.org/Person">
Hello, my name is
<span itemprop="name">John Doe</span>,
I am a
<span itemprop="jobTitle">graduate research assistant</span>
at the
<span itemprop="affiliation">University of Dreams</span>.
My friends call me
<span itemprop="additionalName">Johnny</span>.
You can visit my homepage at
<a href="http://www.JohnnyD.com" itemprop="url">www.JohnnyD.com</a>.
<section itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
I live at
<span itemprop="streetAddress">1234 Peach Drive</span>,
<span itemprop="addressLocality">Warner Robins</span>,
<span itemprop="addressRegion">Georgia</span>.
</section>
</section>
</source>
 
As the above example shows, Microdata items can be nested. In this case an item of type http://schema.org/PostalAddress is nested inside an item of type http://schema.org/Person.
 
The following text shows how Google parses the Microdata from the above example code. Developers can test pages containing Microdata using Google's ''Rich Snippet Testing Tool''.<ref name="GoogleRS"/>
 
Item
Type: http://schema.org/Person
name = John Doe
jobTitle = graduate research assistant
affiliation = University of Dreams
additionalName = Johnny
url = http://www.johnnyd.com/
address = Item(1)
Item 1
Type: http://schema.org/PostalAddress
streetAddress = 1234 Peach Drive
addressLocality = Warner Robins
addressRegion = Georgia
 
The same machine-readable terms can be used not only in HTML Microdata, but also in other annotations such as [[RDFa]] or [[JSON-LD]] in the markup, or in an external [[Resource Description Framework|RDF]] file in a serialization such as [[RDF/XML]], [[Notation3]], or [[Turtle (syntax)|Turtle]].
 
== Support ==