Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Facebook share button with customized url, title and image

Facebook used to allow custom parameters in the Facebook share button, but it is not working now. What I need is to create a Facebook share button which will have a custom title, url, image, description, etc. It cannot be done using meta tags because there are multiple share buttons on a single page. Each should have a different title, urls, images etc. I heard it can be done using the Facebook app - using app id or something.

I tried this but it's not working:

<a title="send to Facebook" 
  href="http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_SUMMARY&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE_TO_SHARE_OBJECT"
  target="_blank">
like image 478
Gijo Varghese Avatar asked Apr 05 '14 05:04

Gijo Varghese


2 Answers

Unfortunately, it appears that we can't post shares for individual topics or articles within a page. It appears Facebook just wants us to share entire pages (based on url only).

There's also their new share dialog, but even though they claim it can do all of what the old sharer.php could do, that doesn't appear to be true.

And here's Facebooks 'best practices' for sharing.

like image 172
CodeDreamer68 Avatar answered Sep 30 '22 04:09

CodeDreamer68


Use facebook feed dialog instead of share dialog.

Example:

https://www.facebook.com/dialog/feed?app_id=1389892087910588 &redirect_uri=https://scotch.io &link=https://scotch.io &picture=http://placekitten.com/500/500 &caption=This%20is%20the%20caption &description=This%20is%20the%20description

like image 30
kittu Avatar answered Sep 30 '22 06:09

kittu