11

我想向页面添加微数据,但项目的数据被分解为页面的几个不连续部分。如果我有两个span具有itemscope属性的元素,是否可以让搜索引擎合并两个 itemscope 并将它们解释为单个项目?

例如*:

<span itemscope itemtype="http://schema.org/Person">
    Hello, my name is <span itemprop="name">Glinda</span>.
</span>
I like to fly around in a giant bubble.
<span itemscope itemtype="http://schema.org/Person">
    I live in the <span itemprop="location">Land of Oz</span>.
</span>

有没有办法添加类似itemid属性的东西来告诉网络蜘蛛这两个 Personitemscopes应该作为一个项目消费,而不是两个?

也许是这样的。

<span itemscope itemtype="http://schema.org/Person" itemid="7f6ba1">
    Hello, my name is <span itemprop="name">Glinda</span>.
</span>
I like to fly around in a giant bubble.
<span itemscope itemtype="http://schema.org/Person" itemid="7f6ba1">
    I live in the <span itemprop="location">Land of Oz</span>.
</span>

* 我知道在这个例子中我可以只使用一个大跨度,但我不能用我必须使用的实际页面来做到这一点。

编辑:也许我需要一个更好的例子。这有点做作,但说明了我遇到的问题。请记住,重新组织页面不是一种选择。

<h1>Locations</h1>
  <ul>
    <li itemscope itemtype="http://schema.org/Person">
      <span itemprop="name">Bob</span> lives in <span itemprop="location">Berkeley</span>
    </li>
    <li itemscope itemtype="http://schema.org/Person">
      <span itemprop="name">Carol</span> lives in <span itemprop="location">Cupertino</span>
    </li>
  </ul>

<h1>Jobs</h1>
  <ul>
    <li itemscope itemtype="http://schema.org/Person">
      <span itemprop="name">Bob</span> works at <span itemprop="affiliation">Borders</span>
    </li>
    <li itemscope itemtype="http://schema.org/Person">
      <span itemprop="name">Carol</span> works at <span itemprop="affiliation">Capitol One</span>
    </li>
  <ul>

有没有办法让这个微数据产生两个 Person 项目,而不是四个?

我想要 Bob,他住在伯克利,在 Borders 工作,还有 Carol,他住在 Cupertino,在 Capitol One 工作。

4

2 回答 2

12

如果我正确阅读W3 itemref,您可以使用该itemref属性来达到此目的:

<h1>Locations</h1>
  <ul>
    <li  itemscope itemtype="http://schema.org/Person" itemref="bob">
      <span itemprop="name">Bob</span> lives in 
      <span itemprop="homeLocation">Berkeley</span>
    </li>
    <li  itemscope itemtype="http://schema.org/Person" itemref="carol">
      <span itemprop="name">Carol</span> lives in 
      <span itemprop="homeLocation">Cupertino</span>
    </li>
  </ul>
<h1>Jobs</h1>
  <ul>
    <li itemprop="affiliation" itemscope itemtype="http://schema.org/Organization" id="bob">
      Bob works at <span itemprop="name">Borders</span>
    </li>
    <li itemprop="affiliation" itemscope itemtype="http://schema.org/Organization" id="carol">
      Carol works at <span itemprop="name">Capitol One</span>
    </li>
  <ul>
于 2011-12-02T23:57:01.397 回答
0

是的,如果您使用 itemref 属性是可能的。看看这个网站:IJzerfront 14-18

它们将信息联系起来(描述和图像是分开的,并被添加到博物馆广场)。

于 2016-03-16T15:47:11.083 回答