我正在查看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&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。
这样做有什么好处?
答案 0 :(得分:2)
在type http://schema.org/VideoObject
的页面上,您可以找到每个媒体资源的“预期类型”。
对于url
和embedURL
,它会说:“网址”。
如果您想在HTML5中提供网址,you have to使用href
属性(位于link
,a
,...),src
属性(img
,...)或任何其他定义方式。
如果您使用网址作为content
元素的meta
属性的值,则它将表示一个字符串(看起来像一样的URL),而不是URL。
您可以在微观数据规范5.4 Values中找到相关部分。
答案 1 :(得分:1)
他们可能会认为link
元素将在正常的索引机器人操作中处理(即使没有尝试按照Schema.org解释微数据),因为它们通常遵循链接。另一个可能的原因是链接检查器可用于在URL显示为href
属性值时进行验证,或者在特定于URL值的属性中进行验证。
但请注意,Google说明页面Schema.org for Videos上的示例代码使用meta
embedURL
。