谁在添加Facebook元标记

时间:2011-11-17 22:56:20

标签: facebook meta-tags facebook-opengraph

我将以下内容添加到首页的HTML中(从页面顶部开始):

<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="description" content="Blah-Blah-Blah This is my web site">
<meta name="keywords" content="why,does,facebook,suck,so,much">
<meta name="distribution" content="Global">
<meta name="revisit-after" content="30 days">
<meta name="rating" content="General">
<meta name="robots" content="follow,index">
<meta name="author" content="www.me-at-my-wonderful-site.com">
<meta property="og:title" content="My Title" />
<meta property="og:type" content="company" />
<meta property="og:url" content="http://www.my-company-url.com/" />
<meta property="og:image" content="http://www.my-company-url.com/images/facebook_pic.png" />
<meta property="og:site_name" content="My Company Name" />
<meta property="og:description" content="Blah-Blah-Blah" />
<meta property="fb:app_id" content="123456789012345"/>
<meta property="og:latitude" content="56.340609"/>
<meta property="og:longitude" content="-152.435136"/>
<meta property="og:street-address" content="123 1st St."/>
<meta property="og:locality" content="Seattle"/>
<meta property="og:region" content="WA"/>
<meta property="og:postal-code" content="98765"/>
<meta property="og:country-name" content="USA"/>
<meta property="og:phone_number" content="360-123-4567"/>
<title>Title for my web page - Home Page</title>
<link href="icon.ico" rel="SHORTCUT ICON">
<link href="styles.css" type=text/css rel=stylesheet>
<!-- Regular HTML follows -->

假设登录http://www.my-company-url.com可以访问以下内容,我可以在Web浏览器中查看上面的HTML(查看源代码)。但是,当我将相同的网址加载到http://developers.facebook.com/tools/debug时,我得到以下内容:

Errors That Must Be Fixed
Object Invalid Value:   Object at URL 'http://www.my-company-url.com' of type 'website' is invalid because the given value '123456789012345' for property 'fb:app_id' could not be parsed as type 'fbid'.
Missing Required Property:  The og:url property is required, but not present.
Missing Required Property:  The og:type property is required, but not present.
Missing Required Property:  The og:title property is required, but not present.

然后这个

Warnings That Should Be Fixed
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: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:region.
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:phone_number.

现在WTF是这个吗?我没有在我的HTML中指定上面的所有参数???正如你所看到的,我把它变成了“公司”,而不是“网站”......

PS。 123456789012345不是我的真实facebook ID,但它的数字与我的实际ID数相同。

3 个答案:

答案 0 :(得分:5)

  
    

对象无效值:“网站”类型的网址“http://www.my-company-url.com”上的对象无效,因为无法解析属性“fb:app_id”的给定值“123456789012345”类型'fbid'。

  
     

123456789012345不是我的真实Facebook ID,但它与我的实际ID具有相同的位数。

fb:app_id标记应该是Facebook应用程序的ID号,而不是您个人的Facebook个人资料ID。如果您想通过Facebook个人资料管理网页,则应该使用fb:admins,而不是fb:app_id。我怀疑这个错误会产生某种级联效应,阻止Facebook的解析器处理其余的OpenGraph标记。

有关详细信息,请参阅Facebook's OpenGraph documentation页面管理部分。

答案 1 :(得分:1)

看起来您没有指定Open Graph名称空间。

<html xmlns:fb="http://ogp.me/ns/fb#"
      xmlns:og="http://ogp.me/ns#">

此处有关API的更多信息 http://developers.facebook.com/docs/opengraph

答案 2 :(得分:0)

我在运行的基于wordpress的网站上遇到了同样的问题,我能够通过在主体上再次添加开放图形元标记来修复它,并且听起来很奇怪,它确实有效。

如果您在讨论中发布该网站,我可能会提供更多帮助。

相关问题