Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using HTML5+Microdata's <meta> tag in the <body>

I want to specify if the Product is "In Stock" using HTML5+Microdata's <meta> tag using Schema.org.

I am unsure if this is the correct syntax:

<div itemscope itemtype="http://schema.org/Product">
  <h2 itemprop="name">Product Name</h2>
  <dl itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <dt itemprop="price">$1</dt>
    <meta itemprop="availability" itemscope itemtype="http://schema.org/ItemAvailability" itemid="http://schema.org/InStock">
  </dl>
</div>
like image 795
jacko333 Avatar asked Sep 03 '11 13:09

jacko333


People also ask

Can meta tag be placed in body?

01. META tags are only allowed within HEAD (just like, say, TITLE) so by putting it into a BODY, you're essentially creating an invalid markup.

How do you write a meta tag in html5?

The HTML <meta> tag is used for declaring metadata for the HTML document. Metadata can include document description, keywords, author, etc. It can also be used to refresh the page or set cookies. The meta tag is placed between the opening/closing <head> </head> tags.

Does meta need to be in head?

Does the meta tag need to be inside a head tag? Yes, in current versions of Chrome you will get an error such as the following: The Content Security Policy 'default-src 'self'' was delivered via a <meta> element outside the document's <head> , which is disallowed.


1 Answers

The meta tag can't be used with an itemscope like that. The correct way to express this is through a canonical reference using the link tag:

<div itemscope itemtype="http://schema.org/Product">
  <h2 itemprop="name">Product Name</h2>
  <dl itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <dt itemprop="price">$1</dt>
    <link itemprop="availability" href="http://schema.org/InStock">
  </dl>
</div>
like image 104
Lawrence Woodman Avatar answered Oct 13 '22 01:10

Lawrence Woodman