According to Google's documentation about product microdata, when I want to mark product's availability in my internet shop, I should do the following:
<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:
Blockquote Line 569, Column 73: Attribute content not allowed on element p at this point.
So... what is wrong with my code or with google?
EDIT: I also have warnings:
RDFa Core attribute content is not allowed on the p element 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 <!DOCTYPE HTML>
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 descriptions. It did not satisfy me, so I decided that if content
attribute was only allowed on <meta>
tags, let's go with <meta>
:
<p class="centered">Produkt dostępny</p>
<meta itemprop="availability" content="in_stock"/>
This way the code is:
- unambiguous - the meta element is a child of the itemscope element,
- accepted by HTML5 validation tool,
- still recognized properly by Google's tool.
<p>
tag to a<span>
? – nathangiesbrecht Mar 3 at 18:33