当不包含在子元素中时,将 `isRelated` schema.org 链接到父 `Product` [英] Link `isRelated` schema.org to parent `Product` when not contained in child element
问题描述
我正在尝试使用 schema.org 微数据在产品页面上指示多个相关产品.但是子产品是孤立的,因为它们不包含在父 div 中.我尝试使用 itemref
但我一定是使用不正确或者它一定是错误的解决方案.
此外,我无法轻松创建包装 div 或使用 body
元素来创建父元素.我的理想解决方案是将页面结构保持原样,并以某种方式将子产品"div 链接到父级.我以为 itemref
会这样做,但它似乎不起作用.
这是示例 HTML.
<div class="product-name"><h1 itemprop="name">主要产品</h1>
<!-- END main-product div --><!-- 开始相关产品 div --><div class="related-products"><ol class="products-list" id="related-products-list"><li class="item"><div class="product" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product" itemref="main-product"><p class="product-name"><a itemprop="url" href="/some_product1.php"><span itemprop="name">Some Product 1</span></</p>
<li class="item"><div class="product" itemprop="isRelatedTo" itemscope itemtype="http://schema.org/Product" itemref="main-product"><p class="product-name"><a itemprop="url" href="/some_product2.php"><span itemprop="name">Some Product 2</span></</p>
</ol>