Skip to content

zachfeldman/link_to_social

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

link_to_social

This gem adds a special link_to_social method to the Rails view helpers to easily make a regular link into a social sharing link.

If you're unsure of what this means, try clicking on of these example links:

Share link_to_social on LinkedIn

Share link_to_social on Facebook

Usage

Add the gem to your Rails project's Gemfile, then bundle install to get started.

gem 'link_to_social'

To use link_to_social inside your views:

link_to_social "Share Google on Facebook", "http://google.com", network: :facebook

link_to_social "Share Google on Twitter", "http://google.com", network: :twitter

Network options are passed as symbols. Acceptable network options include:

:facebook
:twitter
:linkedin
:googleplus
:tumblr

Some social networks also include optional parameters to include more information with your link, which have been added explicitly as options to link_to_social. Here are some examples:

link_to_social "Share Google on Twitter", "http://google.com", network: :twitter, text: "Google is awesome."

link_to_social "Share Google on LinkedIn", "http://google.com", network: :linkedin, title: "Great Pandas", source: "http://pandafarm.com"

link_to_social("Share Google on Tumblr", "http://google.com", network: :tumblr, name: "A great post.", source: "http://zfeldman.com"

Contributing to link_to_social

Pull requests welcome.

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so we don't break it in a future version unintentionally.
  • Send in a pull request!

Credits

githalytics.com alpha

About

Easily create sharing links in Rails for all of the major social networks using a simple link_to_social tag.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published