简体   繁体   English

有没有办法将标记作为schema.org itemprop的值?

[英]Is there a way to have markup as the value to schema.org itemprop?

Is there a way to have markup as the value to a schema.org itemprop node? 有没有办法将标记作为schema.org itemprop节点的值? Eg this works: 例如,这有效:

<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>

But can you make this work: 但是您可以使这项工作:

<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>

The HTML spec defines what the property value is of an element with an itemscope attribute , and it says for elements other than meta , audio , embed , iframe , img , source , track , video , a , area , link , object , data , meter , or time , “ The value is the element's textContent “. HTML规范定义了具有itemscope属性的元素的属性值 ,并针对metaaudioembediframeimgsourcetrackvideoaarealinkobjectdatametertime ,“ 值是元素的textContent ”。

So the HTML spec requires consumers of microdata markup to ignore markup inside the span element in <span itemprop="genre"> <p>Science</p> <h2>fiction… and just use the text. 因此,HTML规范要求微数据标记的使用者忽略<span itemprop="genre"> <p>Science</p> <h2>fiction…span元素内的标记,而只使用文本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM