The w3C validator was all fine with this code:
<meta property="og:site_name" content="--Sitename--" />
If I replace the property
attribute with name
, the validator says og:site_name
is not registered.
All of a sudden today it displayed this error:
Error Line 7, Column 66: Element
meta
is missing required attributename
.
Nothing is changed but this error popped up.
Anyone knows why, and the solution for that?
If a meta
element has the property
attribute (from RDFa), the name
attribute is not required.
See the section "Extensions to the HTML5 Syntax" from the W3C Recommendation HTML+RDFa 1.1 - Second Edition:
If the RDFa
@property
attribute is present on themeta
element, neither the@name
,@http-equiv
, nor@charset
attributes are required and the@content
attribute MUST be specified.
So your markup is fine:
<meta property="og:site_name" content="--Sitename--" />
But it’s (now) even valid if you use the name
attribute instead of RDFa’s property
, because the OGP values are registered. So this is fine, too:
<meta name="og:site_name" content="--Sitename--" />
And you could even combine both ways:
<meta name="og:site_name" property="og:site_name" content="--Sitename--" />