I am trying to find a good gem that will allow me to add social media sharing buttons to my Rails 3 app (similar to the Wordpress plugins AddThis). The key sites that I want to enable sharing with are Facebook, Twitter, LinkedIn, and Google+. I want to allow two levels of sharing i.e. the ability to share a link to the site as a whole and the ability to share specific pages or posts on the site. Thanks in advance!
What gems would you recommend?
In your Gemfile
:
gem 'social-share-button'
And install it:
$ bundle install
$ rails generate social_share_button:install
here https://github.com/huacnlee/social-share-button
As you shop for these widgets you should not think in terms of Rails solutions but Javascript solutions. Since Rails had adopted JQuery as it default JS framework you can also look in that direction.
Here are a few: http://plugins.jquery.com/?s=social
I recommend shareBox
I found shareable to be pretty good.
Haucnlee's gem unfortunately doesn't support counters (currently), but I was able to use https://github.com/iffyuva/social-buttons to implement this for myself. See for a rails 3 gem for sharing content on social media sites in one click walkthrough.
Sharing to Facebook
http://www.facebook.com/dialog/feed?app_id=123456789&link=http://Domain_name/<%= @post.id %>/<%= @post.name %>&picture=<%= @default_image_of_the_post.image_url %>&name=<%= @post.title %>&caption=<%= @post.caption %>&description=<%= @post.description %>&redirect_uri=http://Domain_name/<%= request.original_url %>&display=popup” target=’_blank’>
Note:
app_id = ‘App_Id’ which is given by facebook. U need to register your app in Facebook
check here ‘https://developers.facebook.com‘ go to Apps tab and click on ‘Create a New
App’
link = This is the link for this particular post, if any user clicks on this post in FB, he will be
redirected to this link
picture = Picture for the post
name = Title of the post
caption = Caption for the post
description = Description for the post
redirect_uri = after posting, To which link u want user to be redirected. Its better to give ‘request.original_url’, user will redirect to same page from where he has been sharing the link
Sharing to Linked in
http://www.linkedin.com/shareArticle?mini=true&url=http://Domain_name/<%= @post.id %>/<%= @post.name %>&title=<%= @post.title %>&summary=<%= @post. description %>” target=”_blank”>
Note:
url = This is the link for this particular post, if any user clicks on this post in Linked in, he will be
redirected to this link
Title = Title for the post
summary = Description for the post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With