3 ms·
you can mark sub-scopes with their own itemscope property, so you could have this: <article itemscope itemtype="/article"> <h1 itemprop="title">My
by phpnode 13y ago
you can mark sub-scopes with their own itemscope property, so you could have this:
<article itemscope itemtype="/article">
<h1 itemprop="title">My Title</h1>
<div class="related-thing" itemscope itemtype="/author" itemprop="author">
<h1>
<span itemprop="firstName">John</span>
<span itemprop="lastName">Smith</span>
</h1>
</div>
<aside class="incidental-unrelated-thing" itemscope itemtype="/sausage">
<span itemprop="type">Cumberland</span>
<span itemprop="ingredients">Mystery Meat</span>
</aside>
</article>
in the example above, we define an article that has a related author property, that author property is its own scope so has firstName and lastName properties of its own. We also define an unrelated itemscope (unrelated because it has no itemprop) that happens to be nested in the same element, so this would parse to:
[
{
"type": "/article",
"properties": {
"title": ["My Title"],
"author": [{
"type": "/author",
"properties": {
"firstName": ["John"],
"lastName": ["Smith"]
}
}]
}
},
{
"type": "/sausage",
"properties": {
"type": ["Cumberland"],
"ingredients": ["Mystery Meat"]
}
}
]