If I want to create a share link for Facebook that works everywhere and has everything I want contained in one URL, I can use Facebook's "sharer.php" functionality. (Facebook says it's officially "deprecated," but there's no sign of them stopping this implementation anytime soon.) So let's say I want to share this link: http://www.otlcampaign.org/blog/2013/02/04/inconvenient-truth-education-reform I can simply add "http://www.facebook.com/sharer/sharer.php?" before the link, and voila!
Thankfully Facebook was able to properly pull a relevant title, blurb, and image from the page to display. However, given that we want to maximize the number of clicks, what if we wanted to customize things? We can! However, it gets much more complicated. Let's say I wanted the title to be The Inconvenient Truth of Education "Reform"!, and have the blurb be Recent events have revealed how market-driven education policies, deceivingly labeled as "reform," are revealing their truly destructive effects on the streets and in the corridors of government:, and have the thumbnail image be this one:
Looks perfect, but the URL looks like this monstrosity:
Yuck. Who wants to replace all those spaces and punctuation marks with HTML code?
Twitter's single-URL method of sharing is a bit more straightforward, simply because there are fewer things to worry about: it's just a message and a link (and maybe a twitter user reference or two). So if I want a link to produce this:
I need a link that looks like this:
Still pretty rough.
I've also included Google+, which unfortunately doesn't allow for any customization to the extent that Facebook does. All you have to do is fill in the fields and click a button. Hope you enjoy!
UPDATE: Manjunath brings up a good point in the comments about mobile sharing: for god knows what reason, Facebook's mobile sharer.php (on m.facebook.com) doesn't use the same parameters. For the mobile Facebook sharer.php, the markup is much simpler, and we can only pick the URL and the title. Like so:
http://m.facebook.com/sharer.php?u=<the url you want>&t=<the title you want>If you want to force mobile browsers to use the regular Facebook sharer.php, you can simply add "&m2w" (w/out quotes) to the end of the regular Facebook share link. I haven't extensively tested that yet, so YMMV.
UPDATE 2, 2/2/2014: Facebook has changed its API, so without a special key you can't customize the share links. Boo. However, I've added Pinterest "Pin It" links!
UPDATE 11/26/2013: By popular request, I've added LinkedIn sharing, and users shouldn't run into any problems using & or # in their text now!