我在 Google 上测试了我的微数据 schema.org:
谷歌工具没有返回任何错误...
**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
您可以看到我使用了多个 itemprop="text"作为网页类型...
有效吗?
如果是,您知道网页类型的 itemprop="url"无效...或者 ItemList 的 itemListElement 有效。我如何识别哪个 itemprop 有效,哪个 itemprop 无效?
----------------///编辑///--------------------------------
<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>
最佳答案
对于同一个项目,您可以多次使用相同的属性(例如,到 specify Schema.org’s name
in different languages )。但请注意Microdata doesn’t define what it should mean当同一属性被指定多次时。
所以像这样的事情完全没问题:
<html itemscope itemtype="http://schema.org/WebPage">
<body>
<div itemprop="text">…</div>
<div itemprop="text">…</div>
</body>
</html>
(请注意,您的具体示例可能存在问题:Schema.org 的 text
property 需要 Text,但您正在使用另一个项目作为值。不过,这并不被禁止。)
(另请注意,大小写很重要,因此必须是 http://schema.org/WPHeader
而不是 http://schema.org/wpheader
.与http://schema.org/WebPage
相同。)
关于html - Microdata schema.org 中多次出现相同的 itemprop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22330275/