问题
I have the following HTML:
<body itemscope itemtype="http://schema.org/WebPage">
<header itemscope itemtype="http://schema.org/WPHeader">
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
</nav>
...
<div itemscope itemtype="http://schema.org/Organization" itemref="objectDetails">
<span itemprop="name">Org name</span><br>
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
...
</span>
</div>
</header>
<ul itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">..</li>
...
</ul>
<div id="objectDetails">
<div itemprop="description">...</div>
<div itemprop="foundingDate">...</div>
...
</div>
</body>
This web page displays information about one particular organization. Some information about organization should be displayed in a page header, other - in the center of a page. With the help of itemref
attribute I can split information about organization and put it on two separate divs.
If I test the above HTML with google structured data testing tool - it extracts info about organization correctly - properties from both divs are shown, but it shows validation error on a WebPage object:
The property
foundingDate
is not recognized by Google for an object of typeWebPage
.
What is the correct way to tell Google that properties that are inside objectDetails div doesn't belong to the outer itemscope (WebPage)? If I add itemscope itemtype="http://schema.org/Organization"
to objectDetails div - then Google sees two separate organizations on my WebPage.
回答1:
This is not possible.
Possible "solutions":
Don’t use an item on a "container" like
html
orbody
. Use it on an element that doesn’t span the whole content, and useitemref
if needed.Use multiple items and specify the same URI in
itemid
for them. However, it’s not clear if/when/how Schema.org supports itemid, and support from consumers is probably bad.(Using RDFa instead of Microdata would allow this naturally.)
Add an untyped item (by adding an
itemscope
withoutitemtype
) to the element containing all properties you don’t want to add to the original parent item. Examples: 1, 2, 3.
来源:https://stackoverflow.com/questions/29135360/how-to-split-itemscope-over-multiple-html-elements