Tuesday, May 31, 2011

Social sharing (Facebook - Twitter - Digg - Delicious)

Hi,

Facebook Share:

For sharing a page in Facebook, it provides a specific URL to share a particular page in facebook. The parameters that are passed are basically just an URL. What facebook does is, it parses the URL and fetches the meta title and description. Now these title and description are added as the title and description of the new Facebook post. For the image of the post, Facebook selects a random image from the page that is being shared. So when you are sharing a page, make sure it has proper title and description.

Here is an example of a sharing a particular page in Facebook:

<a href="http://www.facebook.com/sharer.php?u=<?php echo urlencode("URL_TO_SHARE"); ?>&t=TITLE_OF_POST">Share with Facebook</a>

Digg Share

Similar to Facebook, Digg also provides an URL to share a particular page. The URL of that page needs to be passed as parameter to Digg.

e.g.
<a href="http://digg.com/submit?url=<?php echo urlencode("URL_TO_SHARE"); ?>&title=TITLE_OF_POST">Digg</a>

Share Delicious



Like above del.icio.us also provides an URL to share a link:

<a href="http://del.icio.us/post?url=<?php echo urlencode("URL_TO_SHARE"); ?>&title=TITLE_OF_POST">Share in  Delicious</a>

Twitter Share

Last but not the least is Twitter. Unlike the above links, in Twitter it does not accepts any URL, rather it takes the tweet directly in the URL. But the length of the tweet must be less than 140 characters.

e.g.
<a href="https://twitter.com/?status=<?php echo urlencode("YOUR_TWEET"); ?>">Tweet</a>

Best of luck :)

No comments:

Post a Comment