Reputation: 109
I am trying to do some schema.org markup in HTML5 where some of the properties do not appear as explicit text on the page. Here is a relevant bit:
<div vocab="http://schema.org/">
. . .
<span property="offers" typeof="Offer">
<span property="price">Cover price: $75 (California purchasers must add sales tax)<BR />
Shipping: $5</span>
<span property="availability" content="Available now"> </span>
<span property="priceCurrency" content="USD"> </span>
</span>
</div>
I could leave well enough alone; Google picks up the currency and availability as part of the Offer. However, http://validator.w3.org/nu objects to the content attributes in the spans, and I’d like to find out how to do this right.
I can’t use span property… content… closed with a /> because span is not a void element.
If I use div-tags instead of span-tags, in snippet style, the validator still objects, and Google associates the two attributes with the enclosing Product instead of with the Offer.
The schema.org doc suggests using a meta tag with content attribute. The Google snippet tool accepts that, but it seems bogus as part of the body section, and the nu validator objects to the property attribute.
What is the preferred way to get properties like this into a page without having to put spurious text on it?
Upvotes: 1
Views: 217
Reputation: 940
You have 2 options:
use empty span elements with the content attribute, and choose "RDFa 1.1 Full" when validationg your page at http://validator.w3.org/nu/
use meta elemement with @property and @content attribute and validate them at http://validator.w3.org/nu/ (there is currently a bug in the validator which tells you it is not valid, when in fact it is, but this should be fixed this week. see http://lists.w3.org/Archives/Public/www-validator/2013Jul/0015.html)
Upvotes: 3