I'm sure you've been on a site and seen the "Share this content" headline above a group of social media icons. Click on those icons and it takes you to your account with some pre-populated content in your status message so all you have to do is click a button to spread the word to your friends, followers, associates, or the world.
Here's a quick overview of how to create some of those links on your site.
Share on Twitter
Base URL: http://twitter.com/home
Parameters:
status The message you want them to tweet
Example: http://twitter.com/home?status=@roberocity+showed+me+how+to+pre-populate+Twitter+statuses.%20http%3A%2F%2Fmindflow.robsutherland.net%2F
Whatever you put after the "status=" is what will be pre-populated in the "what are you doing?" field. The tweeter can change that message and then share with their followers. You can use hash tags or anything else. See the note below about url escaping characters below.
When writing your message, write it like you were going to tweet it. You can use @usernames, #hashtags and the RT prefix if you want. You still can't go over the character limit. Keep it simple. This will be a tweet.
Share on Facebook
Base URL: http://www.facebook.com/sharer.php
Parameters:
u the URL to link to
t title of content;
Example:http://www.facebook.com/sharer.php?u=http%3A%2F%2Fmindflow.robsutherland.net%2F&t=Roberocity+showed+me+how+to+share+pre-populate+Facebook+status
Technical documentation from Facebook can be found here.
When writing the title be concise and meaningful.
Share on LinkedIn
Base URL: http://www.linkedin.com/shareArticle
Parameters:
mini must be set to "true" (it is required yet only has one valid option, it might not make sense, but that's how life is sometimes).
url The destination URL
title The title of the article
source The source of the article, name of publication, Web site, etc.
summary A short summary (no more than 256 characters) describing the article
Example: http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Fmindflow.robsutherland.net%2F&title=Pre-populate+LinkedIn+share+article+form+fields&summary=Roberocity+shows+how+to+quickly+add+social+sharing+links+to+any+Web+page&source=Rob+Sutherland+(Roberocity)
LinkedIn provides opportunity to share more information so take advantage of it, but still make it meaningful.
Share via email
Base URL: mailto: (yep, that's it, just a simple mailto: protocol link with no to address)
Parameters:
subject The subject line of the email
body The body of the email
Example: mailto:?subject=FWD+Learn+how+to+create+social+media+sharing+links+&body=http%3A%2F%2Fmindflow.robsutherland.net%2F+has+some+techniques+on+creating+social+media+links+take+a+look
This will simply open up the users email client and pre-populate the subject line and the body of the message. They'll just ender the "to" addresses and click send.
The subject line should be appropriate for email. Avoid spammy words and phrased and keep it shorter than the above (bad) example. The body should be a starting point. Keep it simple and remember that this will be coming from someone else so don't make it too much your own. Keep the language short. Senders will reword and customize the email message anyway to make it more meaningful to the recipients—at least I hope they do.
Further Reading
There are many, many, many other social networking sites that use similar technology. I use these three in my daily life. I also use http://www.delicious.com/ but not so much as a social tool. So this is by no means an exhaustive live, just ones that I'm more familiar with and use most often.
http://www.addthis.com/bookmark.php Lists just about every social media, link sharing, or news site out there. You can take a look at the code used behind the scenes or just click on the network of your choice and see what the URL looks like and deduce for yourself how to create the links.
Implementing this into your content management system or blog engine would be fairly straightforward, but I'll leave that implementation detail up to you. For all I know you already have it available in your blog engine and you're reading this for the heck of it.
URL Encoding
You'll notice all the %20 and %xx strings. Those are escaped characters to keep the URL free of characters that may cause problems like space (%20 or +) and the # (%23) sign that has significance in normal URLs. Some social sites don't require the escaping, but all will accept it so it is a good practice to get into. Use this page to encode the strings for you and make your life easier.
Since you'll need to URL encode some text, here's a couple of handy tools: http://www.albionresearch.com/misc/urlencode.php, http://urlencodedecode.com/, http://meyerweb.com/eric/tools/dencoder/ They all do the same thing and none are pretty so just take your pick and smile.
If you're creating links using javascript just use encode('the text you want to encode') and you're good to go.
End
Let me know any comments or questions. Heck, even point out something I did wrong. I'll listen and answer—promise.
Comments [0]