1

当我在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元标记被忽略?

4

1 回答 1

1

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

于 2012-09-09T13:08:54.293 回答