SocialLinker (a new rubygem)

An article, posted almost 8 years ago filed in ruby, rubygem, gem, social_linker, rails, rubygems by murb, share, privacy, google+, facebook, google & twitter.

I had a few projects that I thought could use some share ‘buttons’, but I didn’t like to include the JavaScript loaded and privacy invading share buttons that the networks try to sell you by default. Neither did I like to concatenate the links with all variables required for each project… so I wrote a small rubygem on a back and forth train trip (#ilovetrains ;)): social_linker.

The idea is that you share something about a certain subject, hence you initalize the SocialLinker::Subject and then you’ll be able to generate share links from it:


How it works

Initialize the subject with enough material to generate links from, such as the page’s url, maybe the media url (mainly for Pinterest type-shares), a description, tags etc.

For example, initialize the SocialLinker::Subject as follows:

social_linker_subject =
  media: "", 
  url: "", 
  title: "Example website", 
  description: " is the typical URL you would want to use in explanations anyway."

You’ll get the e-mail share url by calling:


Which will deliver you the following url:


Or to save you the copy-paste:


The supported options are:

I’ve tried to map them as good as possible to the different share tools. Sometimes by combining several values. You may also pass along link-specific parameters such as :status (for twitter), so no status is generated from the link, the title and the tags (make sure that you include a link though).

You’ll find the MIT-licensed source on Github, suggestions for improvements are welcome (do make sure you write nice tests for them, everything is rspec’d)!

Op de hoogte blijven?

Maandelijks maak ik een selectie artikelen en zorg ik voor wat extra context bij de meer technische stukken. Schrijf je hieronder in:

Mailfrequentie = 1x per maand. Je privacy wordt serieus genomen: de mailinglijst bestaat alleen op onze servers.