问题
Which one is correct?
<link itemprop="availability" href="http://schema.org/InStock">
<meta itemprop="availability" content="InStock" />
<span itemprop="availability" content="in_stock"></span>
I checked official schema documentation and in examples found all of them.
I suppose all of them will work, but at the moment, is there any preferred standard?
回答1:
Using span
with the content
attribute is invalid. Neither HTML5 nor Microdata allow the content attribute for span.
Using meta
is invalid. HTML5 and Microdata require that meta must not be used for URI values.
Using link
is correct. It’s also used in Schema.org’s enumeration guide. If some examples use meta
instead, we may expect these to be fixed.
回答2:
<link itemprop="availability" href="http://schema.org/InStock">
is probably best since it most closely adheres to the Enumeration that is https://schema.org/ItemAvailability.
I wouldn't use the 3rd example (<span itemprop="availability" content="in_stock"></span>
) because in_stock
may not map exactly to the values listed.
来源:https://stackoverflow.com/questions/25148439/schema-org-product-availability-tags-markup