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>
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.
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 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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With