添加分享按钮旁边的Facebook和Facebook评论 [英] Add Share button next to Like and Comment on Facebook Post

查看:191
本文介绍了添加分享按钮旁边的Facebook和Facebook评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook的Feed对话框:
http:// developers.facebook.com/docs/reference/dialogs/feed/

I'm using Facebook's Feed Dialog: http://developers.facebook.com/docs/reference/dialogs/feed/

每当我发布使用它的东西,Facebook都会在底部添加2个链接(Like和评论):

Whenever I post something using it, Facebook adds 2 links at the bottom (Like and Comment):

但是,当我看到Timeline中的其他帖子时,我也看到一个Share链接:

However, when I see other posts in the Timeline, I also see a "Share" link as well:

我如何指示Facebook还可以通过Feed对话框添加Share链接?

How can I instruct Facebook to also add this "Share" link through the feed dialog?

推荐答案

您不能从应用程序获取Feed帖子的共享链接,你可以在第二个例子中说明链接帖子。或者你还可以添加一个这样的帖子的操作链接。

You cannot have share link for feed posts from an application but you can have for link posts as Explained in second example. Or You can also add action links to a post message like this.

FB.ui(
   {
     method: 'feed',
     name: 'Facebook Dialogs',
     link: 'http://venu.com/',
     picture: 'http://venu.com/f8.jpg',
     caption: 'Venu site',
     description: 'asdasdasdasd.',
     message: 'asdasdasd!',
    actions: [
        { name: 'share', link: 'link here' }
      ]

   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );

链接将是您网站/应用中的自定义页面。由于用户正在尝试共享某些其他人发布的消息,所以您应该在服务器中显示该消息。您可以在自定义URl中传递邮件的ID。

Link will be to a custom page in your site/app. Since user is trying to share the messages which was posted by some body else, you should have the message in your server. You can pass the id of the message in the custom URl.

希望这有助于您:)

您可以添加一个分享按钮的链接,您必须使用'我/链接'而不是'我/ feed 。不幸的是,这不是一个完整的替代品,因为当使用此方法时,Facebook忽略了描述,标题和图片参数。这是在这里发布的错误(https://developers.facebook.com/bugs/194522957295380)

You can add a link with share button you have to use 'me/links' instead of 'me/feed'. Unfortunately this isnt a complete replacement as Facebook ignores the description, title and picture parameters when using this method. this is bug posted here.(https://developers.facebook.com/bugs/194522957295380)

$attachment = array(
    'access_token'=>TOKEN_HERE,
    'message'=>'message_here',
    'link' => 'http://www.example.com/',
);

$result = $facebook->api(
    'me/links',
    'post',
    $attachment
);

所以,现在这类似于在你的网站上有一个类似的按钮。 Facebook从给定链接中的打开图表元标签中提取信息。

So, now this is similar to having a like button in your site. Facebook pulls the information from open graph meta tags in the given link.

<head>
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="name for ENTIRE SITE"/>
    <meta property="og:title" content="name of PAGE"/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content="<URL HERE>"/>
    <meta property="og:description" content="my description" />
    <title>Untitled</title>
</head>

这篇关于添加分享按钮旁边的Facebook和Facebook评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆