Use*_*upt 5 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&version=3">
<meta itemprop="playerType" content="Flash">
<meta itemprop="width" content="640">
<meta itemprop="height" content="480">
Run Code Online (Sandbox Code Playgroud)
每次该值为网址时,YouTube都会使用link代码而不是meta代码.
http://validator.w3.org/验证了两者<meta content="http://..." itemprop="url">并且<link href="http://..." itemprop="url">是有效的HTML.
这样做有什么好处?
在类型页面上http://schema.org/VideoObject您可以找到每个属性的“预期类型”。
对于url和embedURL说:“URL”。
如果要在 HTML5 中提供 URL,则必须使用href属性(在link, a, \xe2\x80\xa6 上)、src属性 (img、 \xe2\x80\xa6)或任何其他定义的方式。
如果您使用 URL 作为元素content属性的值meta,它将表示一个字符串(看起来像 URL),而不是 URL。
您可以在微数据规范5.4 值中找到相关部分中找到相关部分。
\n