Need to spread the word on your latest blog-post or article? Look no further than the Facebook sharer! Facebook has over 300 million users world-wide, and the chances are good that you can recruit readers. Adding a “share to facebook” icon easily allows your readers to spread YOUR word. This can be accomplished by using plugins for your blog-service, or “share-all” widgets like AddThis or ShareThis. The problem with these services, are that they over-complicate the simple share functionality that’s often wanted. That’s where implementing specefic Facebook-share functionality comes in very handy.
The Facebook sharer
Facebook has a large development community that uses its extensive API to publish applications, and advanced Facebook features on their sites. The simplest way to spread the word is the basic facebook sharer-url.
By visiting the facebook-sharer page, you can get code to copy/paste into your site to enable sharing fast and simple. All you need to do is choose the desired look of your link, and copy the accompanying code-snippet.
Facebook provides 4 options here:
Linking to the sharer
The sharer accepts 2 parameters when passing in the URL to share. Remember that each variable has to be encoded. Refer to the script provided by Facebook for the exact code for this.
This would give the following url
http://www.facebook.com/sharer.php?u=https://pavsaund.wordpress.com/2/ &t=Sharing links to Facebook
Help the sharer with !
The sharer-bot does a crawl of the url sent in, and extracts the title, page content and relevant images. The bot does this based on it’s own algorithm, and usually this works just fine. The problem occurs when you share a page filled with content and images that may confuse the bot. In these cases, the bot may share the wrong picture or unrelated content.
If you want to control exactly what’s shared then you need to include the following meta tags in your page’s head.
This way, you control exactly what the reader shares from your page. Consider also adding your blog-info in the content, as this rarely gets picked up by the bot (since this is reserved for the end of an article or a separate page)
A few things to keep in mind
The meta names title and description have to be lowercased for the bot to pick them up. Other wise it seemingly ignores them.
The facebook sharer states that when using meta tags, the minimum tags to include are title and description, otherwise metatags are ignored.
Beware when sharing sites with dynamic content linked to a static url. Facebook caches all pages it crawls and may store this cache for several weeks. This may also cause problems for sites with dynamic url, as it seems Facebook my have old DNS lookups cached.
I hope this post is of some value to you. Feedback is always welcome!