【问题标题】:Is there a way to have markup as the value to schema.org itemprop?有没有办法将标记作为 schema.org itemprop 的值?
【发布时间】:2017-03-31 12:36:47
【问题描述】:

有没有办法将标记作为 schema.org itemprop 节点的值?例如。这行得通:

<div itemscope itemtype ="http://schema.org/Movie">
  <h1 itemprop="name">Avatar</h1>
  <span>Director: <span itemprop="director">James Cameron</span> (born August 16, 1954)</span>
  <span itemprop="genre">Science fiction</span>
  <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a>
</div>

但是你能做到吗:

<div itemscope itemtype ="http://schema.org/Movie">
  <h1 itemprop="name">Avatar</h1>
  <span>Director: <span itemprop="director">James Cameron</span> (born August 16, 1954)</span>
  <span itemprop="genre"> <p>Science</p> <h2>fiction</h2></span>      <<====
  <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a>
</div>

【问题讨论】:

    标签: html seo schema.org microdata structured-data


    【解决方案1】:

    HTML 规范 defines what the property value is of an element with an itemscope attribute,它表示除 metaaudioembediframeimgsourcetrackvideo、@ 以外的元素987654331@、arealinkobjectdatametertime,“值是元素的 textContent”。

    因此,HTML 规范要求微数据标记的使用者忽略 &lt;span itemprop="genre"&gt; &lt;p&gt;Science&lt;/p&gt; &lt;h2&gt;fiction… 中的 span 元素内的标记,而只使用文本。

    【讨论】:

      猜你喜欢
      • 2014-07-16
      • 1970-01-01
      • 2014-06-04
      • 2010-10-12
      • 1970-01-01
      • 2014-06-28
      • 1970-01-01
      • 2020-10-13
      • 1970-01-01
      相关资源
      最近更新 更多