Multiple occurences of same itemprop in Microdata schema.org

↘锁芯ラ 提交于 2019-11-26 23:39:54

问题


I tested My microdata schema.org on google:

The google tools did not return any error...

**Item** 
    type:   http://schema.org/webpage
    property:   
    url:    http://127.0.0.1/
    image:  http://127.0.0.1/design/logo.jpg
    datemodified:   2014-03-05 20:12:56
    text:   
    Item 1
    breadcrumb: Skip to content
    text:   
    Item 2



    **Item 1**
    type:   http://schema.org/wpheader
    property:   
    url:    http://127.0.0.1
    headline:   website name
    image:  http://127.0.0.1/design/logo.jpg
    description:    some text


    **Item 2**
    type:   http://schema.org/sitenavigationelement

You can see I used multiple itemprop="text" for the webpage type...

Is it valid?

If yes you know itemprop="url" for WebPage type is invalid... or itemListElement for ItemList is valid. How can I recognize which itemprop is valid and which one is invalid?

----------------///EDIT///-------------------

<html itemscope itemtype="http://schema.org/webpage">
<body>
<div itemprop="text" itemscope="itemscope" itemtype="http://schema.org/wpheader">
...
</div>

<div itemprop="text" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">
...
</div>
</body>
</html>

回答1:


You can have the same property several times for the same item (for example, to specify Schema.org’s name in different languages). But note that Microdata doesn’t define what it should mean when there is the same property more than one time specified.

So something like this is totally fine:

<html itemscope itemtype="http://schema.org/WebPage">
  <body>
    <div itemprop="text">…</div>
    <div itemprop="text">…</div>
  </body>
</html>

(Note that there may be a problem with your specific example: Schema.org’s text property expects Text, but you are using another item as value. It’s not forbidden, though.)

(Also note that the case matters, so it has to be http://schema.org/WPHeader instead of http://schema.org/wpheader. Same with http://schema.org/WebPage.)



来源:https://stackoverflow.com/questions/22330275/multiple-occurences-of-same-itemprop-in-microdata-schema-org

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