Facebook分享不会使用指定的图像&链接

时间:2011-04-05 19:03:59

标签: html facebook share

我正在使用Facebook的Open Graph协议:

http://developers.facebook.com/docs/reference/plugins/like/

这是测试页面的代码。我的理解是,当有人“喜欢”这个时,放在帖子上的图像图标就是他们的 page应该是og:image中指定的页面,帖子中的可链接url应该是og:url中指定的URL。

实际上,它似乎截断了域的URL,而不是使用提供的图像,它似乎随机选择一个(我的猜测是它只是从扫描中看到的第一个图像或代码中的其他地方指定的)。

我在这里做了什么明显错误的事吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>My Site</title>
    <meta property="og:title" content="My Site Title" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="http://www.mysite.org/videos/index/16922653" />
    <meta property="og:image" content="http://b.vimeocdn.com/ts/104/367/104367616_200.jpg" />
    <meta property="og:site_name" content="My Site" />
    <meta property="og:app_id" content="5555555555" />

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="image_src" href="http://b.vimeocdn.com/ts/104/367/104367616_200.jpg" />

</head>

<body>

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="http://www.mysite.org/videos/index/16922653" show_faces="false" width="450" />
</body>   

</html>

更新:@echese

好建议。跑吧,从“调试”部分得到这个反馈:

Data Source "website" extracted from <meta property="og:type" />
Data Source "My Site Title" extracted from <meta property="og:title" />
Data Source "http://www.mysite.org/videos/index/16922653" extracted from <meta property="og:url" />
Data Source Extracted 1 values from <meta property="og:image" />: http://b.vimeocdn.com/ts/104/367/104367616_200.jpg
Data Source "My Site" extracted from <meta property="og:site_name" />

看起来它理解图片网址。它建议我尝试了一些iframe代码,但仍然没有骰子,我没有得到我指定的图像。

2 个答案:

答案 0 :(得分:2)

尝试运行URL Linter,看看您是否可以在网页上找到任何错误。

答案 1 :(得分:0)

嗯,也许(maaaaaaybe)这是因为你在html标签上没有og命名空间.. 或..也许是因为图片的网址与您的网页位于不同的域名?

祝你好运