加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

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

发布时间:2020-12-14 23:22:59 所属栏目:资源 来源:网络整理
导读:我正在查看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
我正在查看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都会使用链接标记而不是元标记.

http://validator.w3.org/验证了两者< meta content =“http:// ...”itemprop =“url”>和< link href =“http:// ...”itemprop =“url”>作为有效的HTML.

这样做有什么好处?

解决方法

在 type http://schema.org/VideoObject的页面上,您可以找到每个属性的“预期类型”.

对于url和embedURL,它说:“URL”.

如果要在HTML5中提供URL,you have to使用href属性(在链接上,a,…),src属性(img,…)或任何其他定义的方式.

如果您使用URL作为元元素的content属性的值,它将表示字符串(看起来像URL),而不是URL.

您可以在Microdata规范5.4 Values中找到相关部分.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读