Search code examples
htmlsemantic-markup

Using the link tag instead of the meta tag in semantic markup when the value is a URL


I was looking at YouTube's HTML source code for video pages and saw these tags:

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

Every time the value is a URL, YouTube uses the link tag instead of the meta tag.

http://validator.w3.org/ validated both <meta content="http://..." itemprop="url"> and <link href="http://..." itemprop="url"> as being valid HTML.

What is the benefit of doing this?


Solution

  • On the page for the type http://schema.org/VideoObject you can find the "Expected Type" for each property.

    For url and embedURL it says: "URL".

    If you want to provide a URL in HTML5, you have to use the href attribute (on link, a, …), the src attribute (img, …), or any other ways that are defined.

    If you use a URL as value of the content attribute of a meta element, it will represent a string (looking like a URL), not a URL.

    You can find the relevant part in the Microdata spec, 5.4 Values.