How to split itemscope over multiple HTML elements?

穿精又带淫゛_ 提交于 2019-12-11 03:28:42

问题


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 type WebPage.

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 or body. Use it on an element that doesn’t span the whole content, and use itemref 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 without itemtype) 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!