3

我应该使用<meta>显示 UserInteraction http://schema.org/UserInteraction还是可以使用 span

我应该只用这种方式吗

<div itemscope itemtype="http://schema.org/Article">
  <span itemprop="name">How to Tie a Reef Knot</span>
  by <span itemprop="author">John Doe</span>
  This article has been tweeted 1203 times and contains 78 user comments.
  <meta itemprop="interactionCount" content="UserTweets:1203"/>
  <meta itemprop="interactionCount" content="UserComments:78"/>
</div>

或者我可以使用

<div itemscope itemtype="http://schema.org/Article">
  <span itemprop="name">How to Tie a Reef Knot</span>
  by <span itemprop="author">John Doe</span>
  This article has been tweeted 
  <span itemprop="interactionCount" content="UserTweets:1203" >1203</span> times and
  contains <span itemprop="interactionCount" content="UserComments:78">1203</span> 
  user comments.
</div>

谷歌和其他引擎也会显示用户喜欢和评论和文章的评论号

4

2 回答 2

2

您可以使用任何一种;没有语义差异。实际上,如果您查看Microdata 规范 2.2 节中的最后一个示例,它会给出一个与您的示例非常相似的示例:

例如,以下两个示例之间没有语义差异:

<figure>
 <img src="castle.jpeg">
 <figcaption>
   <span itemscope><span itemprop="name">The Castle</span></span> (1986)
 </figcaption>
</figure>

<span itemscope><meta itemprop="name" content="The Castle"></span>
<figure>
 <img src="castle.jpeg">
 <figcaption>The Castle (1986)</figcaption>
</figure>
于 2011-11-07T13:02:06.673 回答
1

I'm trying to get an answer to that myself. I don't think you can use content outside of a meta element though, so I don't think that the example would be valid.

Ideally I would probably place it in the data element

<data itemprop="interactionCount" value="UserTweets:1203">1203 Tweets</data>
<data itemprop="interactionCount" value="UserComments:78">78 user comments</data>

The value attribute is supposed to be the 'machine value', though I'm not sure of how well this is supported at the moment.

于 2011-11-07T17:37:09.447 回答