Facebook喜欢网页按钮说明

时间:2012-05-04 10:16:21

标签: facebook facebook-graph-api facebook-like

我看到网页标题,链接,图片,但我无法获得任何说明。当用户点击网页上的内容时,我的客户想要描述文本。这不可能吗??

我不得不使用旧的共享方式,因为新网站不能与网站上的其他内容一起使用。

我通过Facebook调试器运行它,它说的唯一问题是:

Open Graph Warnings That Should Be Fixed:

Parser Mismatched Metadata: The parser's result for this metadata did not match the input metadata. Likely, this was caused by the data being ordered in an unexpected way, multiple values being given for a property only expecting a single value, or property values for a given property being mismatched. Here are the input property =>content pairs that were not seen in the parsed result: 'og:description => the site desc'

但我认为这只是因为我也使用<meta name="description">。因为它确实在调试器中获取并显示此信息:

Raw Open Graph Document Information

Meta Tag:   <meta property="og:url" content="http://website.nu/" />
Meta Tag:   <meta property="og:image" content="http://website.nu/img/img200x200.jpg" />
Meta Tag:   <meta property="og:title" content="website title" />
Meta Tag:   <meta property="og:type" content="website" />
Meta Tag:   <meta property="og:site_name" content="site_name" />
Meta Tag:   <meta property="fb:admins" content="[my fb id]" />
Meta Tag:   <meta property="og:description" content="site desc" /> 

网站源代码:

<head>  
    <meta name="description" content="Page description">

    <meta property="og:url" content="http://website.nu/"/>
    <meta property="og:image" content="http://website.nu/img/img_200x200.jpg"/>
    <meta property="og:title" content="Site title"/>
    <meta property="og:type" content="website"/>    
    <meta property="og:site_name" content="Site name"/> 
    <meta property="fb:admins" content="[my_fb_id]"/>
    <meta property="og:description" content="Page description, expected to output"/>    
</head>
<body>
    <iframe src="http://www.facebook.com/plugins/like.php?href=http://website.nu/index.php/&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:94px; height:20px;" allowTransparency="true"></iframe>
</body>

3 个答案:

答案 0 :(得分:0)

尝试将&lt; meta name =“description”&gt; &lt; meta property =“og:description”&gt;之后的标记标签

答案 1 :(得分:0)

og:description需要在og:image属性之后。 至少那对我有用。 og之后的描述:描述或删除描述-metatag没有改变任何东西。

答案 2 :(得分:0)

尝试trim您的内容,例如:

echo '<meta property="og:description" content="' . trim($content) . '"/>';