Facebook Open Graph and Metatags

2020-02-11 12:05发布

I have the following output at https://developers.facebook.com/tools/debug

I added the locale metatag, because I had a lot of Extraneous Property errors. But that does not solve it.

Extraneous Property: Objects of this type do not allow properties named og:latitude
Extraneous Property: Objects of this type do not allow properties named og:longitude.
Extraneous Property: Objects of this type do not allow properties named og:region.
Extraneous Property: Objects of this type do not allow properties named og:street-address.
Extraneous Property: Objects of this type do not allow properties named og:locality.
Extraneous Property: Objects of this type do not allow properties named og:postal-code.
Extraneous Property: Objects of this type do not allow properties named og:country-name.
Extraneous Property: Objects of this type do not allow properties named og:email.
Extraneous Property: Objects of this type do not allow properties named og:phone_number.
Extraneous Property: Objects of this type do not allow properties named og:fax_number.

I also have the namespaces in the <html> tag:

<html 
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:og="http://ogp.me/ns#" 
    xmlns:fb="http://ogp.me/ns/fb#">

I have also tried xmlns:fb="https://www.facebook.com/2008/fbml" as suggested here: https://developers.facebook.com/docs/opengraph/

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

I have checked this thread Facebook Open Graph locale for Australia and this Object Debugger gives me Extraneous Property And Inferred Property error on opg

But I still have the Extraneous Property error

Edit: I used this documentation: https://developers.facebook.com/docs/opengraph/#extra-data When I browse to the namespace definition of open graph, I don't see the latitude and longtitude options, but Facebook's documentation does recommend it. But the debugger of Facebook does not accepts it. I am missing something here...

Edit2: I have:

<meta property="og:type" content="company" />

but Facebook says: https://graph.facebook.com/10150616664862786

type: website ???

Why does Facebook see a different type? And how do I fix this?

3条回答
Rolldiameter
2楼-- · 2020-02-11 12:12

Facebook's documentation is out of date, (big surprise there.) The only allowed og:types can be found here, none of which are company.

查看更多
▲ chillily
3楼-- · 2020-02-11 12:27

This is because even though you have specified og:type=company, the linter is showing that your type is website, and the properties you are trying to use are not applicable for a website object type. There is an accepted answer for this here. Your real problem is that the linter is reading og:type incorrectly.

查看更多
叼着烟拽天下
4楼-- · 2020-02-11 12:32

You should also remember to add namespace declaration to the head and body tags of your page.

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xmlns:fb="https://www.facebook.com/2008/fbml"> 
   <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns# YOUR_NAMESPACE: http://ogp.me/ns/apps/YOUR_NAMESPACE#"> 
     <meta property="fb:app_id" content="YOUR_APP_ID" /> 
     <meta ...

Obviously, replace YOUR_NAMESPACE and YOUR_APP_ID with your app's settings.

查看更多
登录 后发表回答