2014-10-29 80 views
0

我想要一个部分,用户可以通过我们的应用在不同的社交媒体平台上分享某个链接。我的twitter链接正常工作,但Facebook,LinkedIn和G +仅共享URL而不是自定义消息。通过Facebook,LinkedIn和Google Plus共享

a.twitter-share-button href="http://twitter.com/intent/tweet?source=sharethiscom&text=BlahBlahBlah&url=http://#{Figs.ms.url}/#{@app.uuid}" target="_blank" 

的Facebook

a.fb-share-button href="https://www.facebook.com/sharer.php?u=http://#{Figs.ms.url}/#{@app.uuid}&t=BlahBlahBlah target="_blank" 

LinkedIn

a.linkedin-share-button href="https://www.linkedin.com/cws/share?url=http://#{Figs.ms.url}/#{@app.uuid}&summary=BlahBlahBlah” target="_blank" 

G +

a.gplus-share-button href="https://plus.google.com/share?url=http://#{Figs.ms.url}/#{@app.uuid}" target="_blank" 

我希望自定义消息是BlahBlahBlah,所以当他们点击任何这些链接时,它会填写自定义消息并包含链接。

回答

0

当前网页的网址是(request.original_url)

  1. 对于Facebook来说,你可以做到以下几点,有关详细信息请检查docs了解更多详情:

%a.fb -share按钮{:HREF => “https://www.facebook.com/dialog/share?app_id=# {APP_ID} &显示弹出= & HREF =#{URL_TO_SHARE} & REDIRECT_URI =#{request.original_url}”, ROL E: “菜单项”,tabindex属性: “-1”,目标: “_blank”}

您可以通过他们addting到URL_TO_SHARE meta标签定制页面的标题,描述,预览照片。查询Open Graph Object Meta Tags了解更多详情。

%meta{:content => "1234567890", :property => "fb:app_id"}/ 
%meta{:content => "http://samples.ogp.me/136756249803614", :property => "og:url"}/ 
%meta{:content => "Chocolate Pecan Pie", :property => "og:title"}/ 
%meta{:content => "https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851565_496755187057665_544240989_n.jpg", :property => "og:image"}/ 
  • 对于LinkedIn
  • %一{:HREF => “http://www.linkedin.com/shareArticle?mini=true&url=# {URL_TO_SHARE} &标题=#{TILTE} &摘要=# {发明内容} &源= www.YOUR_DOMAIN.com”, 角色: “菜单项”,的tabindex: “-1”,目标: “_blank”}

    +0

    是它需要我有一个应用程序ID才能在我的应用程序上创建一个自定义共享按钮,并链接到他们创建的另一个页面?似乎非常过分。此外,当我尝试将摘要添加到LinkedIn url时,它并未被填充。 – user3828551 2014-10-31 15:28:32

    +0

    对于Facebook,您不必传递app_id,但它很适合应用分析。对于linkedin,摘要最多应为256个字符,请查看其[文档](https://developer.linkedin.com/documents/share-linkedin) – mohameddiaa27 2014-10-31 15:37:14