2017-07-07 63 views
2

有人可能会建议为用户可以购买某种产品的页面添加正确的Schema.org标记的最佳方式吗?我在那里添加Product标签(用于Rich Snippets)。Schema.org标记的'产品'内的问题和答案

我想增加提问的可能性,关于这个产品,但我没有找到什么属性,我可以用作嵌入物品。

实施例:

<div itemscope="" itemtype="http://schema.org/Product"> 
    <meta itemprop="brand" content="Brand"> 
    <meta itemprop="url" content="URL"> 
    ...... 

    <div id="question1" itemprop=??????? itemscope="" itemtype="http://schema.org/Question"> 
     ...... 
     <div id="answer1" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
     <div id="answer2" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
    </div> 
    ... 
    <div id="question10" itemprop=??????? itemscope="" itemtype="http://schema.org/Question"> 
     ...... 
     <div id="answer1" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
     <div id="answer2" itemprop=??????? itemscope="" itemtype="http://schema.org/Question/Answer">....</div> 
    </div> 
</div> 

回答

1

没有属性到Question添加到Product
但有一个属性表明Question约为Productabout

Microdata可以用不同的方式标记这种方式。下面是使用itemref一个例子:

<div id="product-42" itemprop="about" itemscope itemtype="http://schema.org/Product"> 
</div> 

<div itemscope itemtype="http://schema.org/Question" itemref="product-42"> 
</div> 

<div itemscope itemtype="http://schema.org/Question" itemref="product-42"> 
</div> 

要链接的AnswerQuestion,你可以使用suggestedAnswer/acceptedAnswer

+0

非常感谢!所以没有办法在Product div中包含问题div块,因为不幸的是我不允许更改html结构很多? –

+0

@尼卡德卡奇:有两种方法。 1)你可以使用'itemprop-reverse'属性(它不是Microdata规范的一部分)在另一个方向指定'about'。 2)你可以使用'itemid'来为你的产品提供一个URI作为ID,并使用这个URI作为'about'属性的值(例如,在'link'元素中)。 - 对于这两种方法,您可以在[我对问题的回答* Microdata *中的独立元素链接](https://stackoverflow.com/a/38663388/1591669)中找到示例。 – unor

+0

非常感谢@unor! –