The W3C validator shows a new error: "Meta requires the attribute" name ",

The w3C validator was ok with this code:

<meta property="og:site_name" content="--Sitename--" /> 

If you replace the property attribute with name , the validator says that og:site_name not registered.

Today, this error appeared unexpectedly:

Error line 7, column 66: meta element missing required attribute name .

Nothing has changed, but this error has appeared.

Does anyone know why, and the solution for this?

+6
source share
3 answers

For HTML5

If the meta element has a property attribute (from RDFa), then the name attribute is not .

See " HTML5 Syntax Extensions " in W3C Recommendation HTML + RDFa 1.1 - Second Edition:

If the RDFa attribute @property present in the meta element, the @name , @http-equiv and @charset attributes are not required, and the @content attribute MUST be specified.

So your markup is fine:

 <meta property="og:site_name" content="--Sitename--" /> 

But its (now) is even valid if you use the name attribute instead of RDFas property , because OGP values ​​are registered . So this is good too:

 <meta name="og:site_name" content="--Sitename--" /> 

And you can even combine both paths :

 <meta name="og:site_name" property="og:site_name" content="--Sitename--" /> 
0
source

It is hard to get which validator and in what mode you are using. Assume validator.w3.org . Then note that HTML5 support exists "experimentally." And the "property" tags refer to rdfa, which is part of the HTML5 standard. To dive into further details, you will need a code snippet or page URL ...

0
source

I had the same problem that I find really mumbling.

This may not be the answer you expected, but I recommend using http://validator.nu/ instead of the W3C validator.

-1
source

Source: https://habr.com/ru/post/948000/


All Articles