【问题标题】:Facebook like button not picking up correct thumbnailFacebook like 按钮没有拾取正确的缩略图
【发布时间】:2012-09-09 21:08:54
【问题描述】:

当我在 og:image 元标记中指定图像时,我不知道为什么 facebook like 按钮会从网站主页拉出随机图像。

这里是html:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Keeper Local</title>
    <meta name="description" content="Keeper Local"/>
    <meta name="keywords" content="Keeper Local"/>
    <meta property="og:title" content="KeeperLocal"/>
    <meta property="og:url" content="http://www.keeperlocal.com"/>
    <meta property="og:image" content="http://keeperlocal.com/images/keeperlocallogo.jpg"/>
    <meta property="og:description" content="Local shopping"/>
    <meta property="og:site_name" content="KeeperLocal.com"/>
    <meta property="og:type" content="website"/>
    </head>
    <body>
    <img src="http://keeperlocal.com/images/keeperlocallogo.jpg">
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div id="page-wrap">
        <fb:like url="http://www.keeperlocal.com/test.html" send="false" layout="box_count" show_faces="false" width="50" height="40" action="like" colorscheme="light"></fb:like>
    </div>
    </body>
</html>

如果您想实时查看,此测试页面位于 http://www.keeperlocal.com/test.html。为什么og:image 元标记被忽略?

【问题讨论】:

    标签: facebook


    【解决方案1】:

    您的图片太小。 Facebook 要求 og:images 的一侧至少为 200 像素。查看调试器:https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.keeperlocal.com%2Ftest.html

    【讨论】:

    • 不这么认为。根据调试器, og:image 标记被“推断”,因此选择了错误的图像。来自调试器:Inferred Property The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags. 但是标签在文档头部。
    • 看看下一行:Tiny og:image: All the images referenced by og:image must be at least 200px in both dimensions.
    • 是的,og:image 元 (keeperlocal.com/images/keeperlocallogo.jpg) 中指定的图像在每个方向上都超过 200 像素 (207 x 207)。但这不是 facebook 使用的图像。 Facebook 选择的随机图片实际上小于 200 像素。
    • 我看到你更新了你的图片,而不是之前的 207x137。现在您需要再次访问调试器以重置 Facebook 缓存,并给 Facebook 大约 1 小时的时间将数据推送到他们的所有服务器。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-24
    • 1970-01-01
    • 2011-02-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多