According to Google’s documentation about the Product Rich Snippet, when I want to mark product’s availability in my shop, I should do the following (using Microdata):
<span itemprop="availability" content="in_stock">In stock! Order now!</span>
And I do similar:
<p class="centered" itemprop="availability" content="in_stock">Produkt dostępny</p>
Unfortunately the W3C validator reports an error on this:
Line 569, Column 73: Attribute
contentnot allowed on element
pat this point.
So, what is wrong with my code or with Google?
EDIT: I also have warnings:
RDFa Core attribute
contentis not allowed on the
pelement in HTML5 + RDFa 1.1 Lite documents. Consider checking against the HTML5 + RDFa 1.1 schema instead.
But if I understand specs correctly, HTML5 implies RDFa 1.1, not 1.1 Lite? My DOCTYPE is
EDIT2: I got the solution now
Despite my code in question not being correct HTML5 code, it was correctly recognized by Google’s tool for testing Rich Snippets. It did not satisfy me, so I decided that if
content attribute was only allowed on
<meta> tags, let’s go with
<p class="centered">Produkt dostępny</p> <meta itemprop="availability" content="in_stock"/>
This way the code is:
- unambiguous - the
metaelement is a child of the
- accepted by HTML5 validation tool,
- still recognized properly by Google’s tool.