there is no attribute “property” in facebook meta

2019-04-16 02:13发布

问题:

can we use the meta name="fb:admins" instead of meta property="fb:admins" for w3c validation ??

回答1:

I'm answering this even though this is an old question since I think it's of value for whoever wants info on this in the future. Evan's probably right when he says it won't pass validation, but I think the answer is that you want to keep the property="" attribute. Taking from an old Facebook developer forum post concerning this question exactly it turns out your document should be an XHTML + RDFa document. This will validate in W3C, thanks to the DOCTYPE declaration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
    version="XHTML+RDFa 1.0"
    xmlns:og="http://ogp.me/ns#"
    xml:lang="en">
  <head>
    <title>Virtual Library</title>
    <meta property="og:title" content="My Website"/>
  </head>
  <body>
    <p>Moved to <a href="http://example.org/">example.org</a>.</p>
  </body>
</html>

You can find out more in in the W3C spec for RDFa, and in this specific example of <meta property=""/>.



回答2:

No, you'll just get this:

Line 1, Column 123: Bad value fb:app_id for attribute name on element meta: Keyword fb:app_id is not registered.
…="fb:app_id" content="176557225718913"><meta charset="utf-8"><meta name="descr…
Syntax of metadata name:
A metadata name listed in the HTML specification or listed in the WHATWG wiki. You can register metadata names on the WHATWG wiki yourself.