当值是URL时,在语义标记中使用链接标记而不是元标记

时间:2013-07-27 01:00:19

标签: html html5 semantic-markup

我正在查看YouTube的视频页面HTML源代码,并看到了这些标签:

<div id="watch7-container" itemscope itemtype="http://schema.org/VideoObject">
  <link itemprop="url" href="http://www.youtube.com/watch?v=ikbEBp5BeCM">
  <meta itemprop="name" content="THE TEST">
  <meta itemprop="duration" content="PT1M10S">
  <meta itemprop="unlisted" content="False">
  <link itemprop="embedURL" href="http://www.youtube.com/v/ikbEBp5BeCM?autohide=1&amp;version=3">
  <meta itemprop="playerType" content="Flash">
  <meta itemprop="width" content="640">
  <meta itemprop="height" content="480">

每次该值为网址时,YouTube都会使用link代码而不是meta代码。

http://validator.w3.org/已将<meta content="http://..." itemprop="url"><link href="http://..." itemprop="url">验证为有效的HTML。

这样做有什么好处?

2 个答案:

答案 0 :(得分:2)

type http://schema.org/VideoObject的页面上,您可以找到每个媒体资源的“预期类型”。

对于urlembedURL,它会说:“网址”。

如果您想在HTML5中提供网址,you have to使用href属性(位于linka,...),src属性(img,...)或任何其他定义方式。

如果您使用网址作为content元素的meta属性的值,则它将表示一个字符串(看起来像一样的URL),而不是URL。

您可以在微观数据规范5.4 Values中找到相关部分。

答案 1 :(得分:1)

他们可能会认为link元素将在正常的索引机器人操作中处理(即使没有尝试按照Schema.org解释微数据),因为它们通常遵循链接。另一个可能的原因是链接检查器可用于在URL显示为href属性值时进行验证,或者在特定于URL值的属性中进行验证。

但请注意,Google说明页面Schema.org for Videos上的示例代码使用meta embedURL