MarcoMorawec / SiB-Dev-Team

All SiB Dev Team Mojo
4 stars 0 forks source link

Adding Social Sharing Buttons to a Rails App #15

Open MarcoMorawec opened 11 years ago

MarcoMorawec commented 11 years ago

A good Gem for doing this is here

Steps to get this working:

Add the shareable gem:

gem 'shareable'
bundle install

--> Add this to your index file to get FB, Twitter and G+:

        <%= twitter_button :title=> 'Draw the fucking Owl', :url=> 'http://drawthefuckingowl.com' %>
        <%= facebook_button :title=> 'Draw the fucking Owl', :url=> 'http://drawthefuckingowl.com' %>
        <%= google_plus_button :title=> 'Draw the fucking Owl', :url=> 'http://drawthefuckingowl.com' %>

--> run the following to generate a sharable initializer:

rails g shareable:config

--> open the generated sharable.rb file and make adjustments as you need them. I did the following for the twitter feed:

  ##############
  #twitter
  ##############
  config.via='DrawTheOwl'
  config.text='Good advice for people who love startups'
  #config.related=''
  config.count='horizontal'
  #config.lang='en'
  config.counturl='http://www.drawthefuckingowl.com'
  #config.hashtags='#startup #advice'
  #config.size='medium'
  #config.dnt=''

--> restart your server and you're done