我想使用 Microdata 和 Schema.org 来定义我的网页的主要内容,所以我做了这样的事情:
<body itemscope="itemscope" itemtype="http://schema.org/WebPage">
...
<div itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/WebPageElement">
<div itemprop="breadcrumb" itemscope="itemscope" itemtype="http://schema.org/BreadcrumbList">...</div>
</div>
...
</body>
问题是,当我检查 Google 结构化数据测试工具下的架构时,我收到错误:
对于 WebPageElement 类型的对象,Google 无法识别属性 breadcrumb。
那么怎么说呢breadcrumb
与itemscope
of the WebPage
而不是到itemscope
of the WebPageElement
?由于设计原因,我无法获得breadcrumb
出于WebPageElement
div
.
顺便说一句,我用breadcrumb
举个例子——它可以是任何其他属性,比如copyrightHolder
or headline
, 例如。
有一个丑陋的解决方案: add a div
与itemscope
(但没有itemtype
) 作为父级breadcrumbs
财产和使用itemref
添加breadcrumb
财产给WebPage
item.
<body itemscope="itemscope" itemtype="http://schema.org/WebPage" itemref="breadcrumbs">
<div itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/WebPageElement">
<div itemscope>
<div itemprop="breadcrumb" itemscope="itemscope" itemtype="http://schema.org/BreadcrumbList" id="breadcrumbs">…</div>
</div>
</div>
</body>
我不推荐这样做(但它是有效的微数据)。您确实应该尝试更改标记结构,以便不必像那样嵌套它。
话虽如此,您可能想使用mainEntity/mainEntityOfPage代替mainContentOfPage, 因为mainContentOfPage
只为WebPageElement
项,这使得它不是很有用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)