Skip to main content
Tweeted twitter.com/#!/StackWebmasters/status/400760639033204736
Removed hyperlink, as it pointed to W3school instead of W3.org.
Source Link
Edward Touw
  • 443
  • 1
  • 4
  • 9

Can I use <link> tags in the body of an HTML page? I tried to find the answer to this question, but found contradictory information.

When adding Schema.org microdata markup to an HTML page, I want to add canonical info in a link tag like this:

<div itemscope itemtype="http://schema.org/Book">
  <span itemprop="name">The Catcher in the Rye</span>—
  <link itemprop="url" href="http://en.wikipedia.org/wiki/The_Catcher_in_the_Rye" />
  by <span itemprop="author">J.D. Salinger</span>
</div>

I got the example code above from Schema.org. According to them, this is the way to go for people that want to add a canonical reference to an itemprop, but don't want to place a hyperlink on their website.

W3 however clearly statesclearly states that <link> tags should only be placed within the head section, thus making the Schema.org example invalid.

If I want to stick to correct markup, which advice should I follow?

Can I use <link> tags in the body of an HTML page? I tried to find the answer to this question, but found contradictory information.

When adding Schema.org microdata markup to an HTML page, I want to add canonical info in a link tag like this:

<div itemscope itemtype="http://schema.org/Book">
  <span itemprop="name">The Catcher in the Rye</span>—
  <link itemprop="url" href="http://en.wikipedia.org/wiki/The_Catcher_in_the_Rye" />
  by <span itemprop="author">J.D. Salinger</span>
</div>

I got the example code above from Schema.org. According to them, this is the way to go for people that want to add a canonical reference to an itemprop, but don't want to place a hyperlink on their website.

W3 however clearly states that <link> tags should only be placed within the head section, thus making the Schema.org example invalid.

If I want to stick to correct markup, which advice should I follow?

Can I use <link> tags in the body of an HTML page? I tried to find the answer to this question, but found contradictory information.

When adding Schema.org microdata markup to an HTML page, I want to add canonical info in a link tag like this:

<div itemscope itemtype="http://schema.org/Book">
  <span itemprop="name">The Catcher in the Rye</span>—
  <link itemprop="url" href="http://en.wikipedia.org/wiki/The_Catcher_in_the_Rye" />
  by <span itemprop="author">J.D. Salinger</span>
</div>

I got the example code above from Schema.org. According to them, this is the way to go for people that want to add a canonical reference to an itemprop, but don't want to place a hyperlink on their website.

W3 however clearly states that <link> tags should only be placed within the head section, thus making the Schema.org example invalid.

If I want to stick to correct markup, which advice should I follow?

Source Link
Edward Touw
  • 443
  • 1
  • 4
  • 9

Can I use <link> tags in the body of an HTML document?

Can I use <link> tags in the body of an HTML page? I tried to find the answer to this question, but found contradictory information.

When adding Schema.org microdata markup to an HTML page, I want to add canonical info in a link tag like this:

<div itemscope itemtype="http://schema.org/Book">
  <span itemprop="name">The Catcher in the Rye</span>—
  <link itemprop="url" href="http://en.wikipedia.org/wiki/The_Catcher_in_the_Rye" />
  by <span itemprop="author">J.D. Salinger</span>
</div>

I got the example code above from Schema.org. According to them, this is the way to go for people that want to add a canonical reference to an itemprop, but don't want to place a hyperlink on their website.

W3 however clearly states that <link> tags should only be placed within the head section, thus making the Schema.org example invalid.

If I want to stick to correct markup, which advice should I follow?