Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
461 views
in Technique[技术] by (71.8m points)

html - Multiple occurences of same itemprop in Microdata schema.org

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...