valid xhtml meta tags for facebook open-graph and

2019-01-15 22:47发布

问题:

to make valid:

  • xhtml
  • twitter cards
  • facebook-graph-api

for http://www.theyact.com/acting-classes/los-angeles/

I've managed to get my code to come up valid everywhere...
save 1 error on http://validator.w3.org/

there is no attribute "property"

but only 1 instance among the many in the code, only the below seems to ruffle the validator's feathers:

<meta name="og:description" property="og:description" content="...

I'd like the code to be completely valid in validator.w3.org's eyes. What am I missing?

回答1:

If you remove this element, the validator will complain about the next one containing the property attribute.

The property attribute is part of RDFa, but your DOCTYPE doesn’t allow the use of RDFa.

If you want to keep using XHTML 1.1, you could change it to:

  • for RDFa 1.0: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

  • for RDFa 1.1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">

Or simply switch to (X)HTML5, which comes with RDFa 1.1 support.