Reputation: 913
I've got a web page I'd like to setup Schema.org Product
for, however the data I need for this is spread throughout the page.
Is there a way to have multiple div
elements for the Schema.org Product
?
Upvotes: 0
Views: 131
Reputation: 449
With Microdata you can use the itemref attribute: http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#attr-itemref
It allows you to refer to other elements on the page by their ids. What's inside those ideas have their itemprops included in the current scope. Here's a simple example.
<div id="janedoeimage" >
<img src="janedoe.jpg" itemprop="image" />
</div>
<div itemscope itemtype="http://schema.org/Person" itemref="janedoeimage">
<span itemprop="name">Jane Doe</span>
</div>
This parses to the following JSON:
{
"items": [
{
"type": [
"http://schema.org/Person"
],
"properties": {
"image": [
"http://example.com/janedoe.jpg"
],
"name": [
"Jane Doe"
]
}
}
]
}
RDFa Lite may soon be getting a way to do prototyping which is similar to Microdata's itemref attribute. I'm not sure where this currently is in the process, though.
Upvotes: 1