2

我想在我的 django 应用程序中使用“在 Facebook 上分享”功能,而不是新的“FB Like”。但我找不到如何实现它并设置要共享的描述、标题和图像。

谁能帮我?

更新

我正在按照德隆格说的做。这是代码:

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

<head>
    <title>Bra</title>
    <link rel="image_src" href="http://site.com/images/logo.jpg" />
    <meta name="description" content="description here">
</head>

<body>
    <a name="fb_share" type="button" share_url="http://www.sharedomain.com/path/" href="http://www.facebook.com/sharer.php?u=http:/www.sharedomain.com/path&amp;src=sp" style="text-decoration: none; ">Share</a><script src="http://static.ak.fbcdn.net/con
nect.php/js/FB.Share" type="text/javascript"></script>
</body>

</html>

但是当我点击按钮时,我看到了这个错误的结果:

在此处输入图像描述

想法?

4

1 回答 1

3

我同意“分享”按钮在某些情况下更有用。见代码:

<a name="fb_share" type="button_count" share_url="http://www.sharedomain.com/path/" href="http://www.facebook.com/sharer.php?u={INSERT ENCODED share_url HERE}&amp;src=sp" style="text-decoration: none; ">Share</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

类型包括:1)button_count 2)按钮 3)链接。

标题将来自页面本身。但是,要添加图标图像,只需将以下内容添加到您的 HTML 中<head>

<link rel="image_src" href="http://www.sharedomain.com/path/thumbnail.jpg" />

我知道您正在使用 django 进行开发,我建议您对 FB Share 按钮进行硬编码。这是因为 Facebook 不再推动它,并且大多数 API 正在消失。

于 2011-05-12T19:25:40.557 回答