Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ShareThis custom summary,url and title for facebook

I have integrated sharethis into my site. I want to customize the title and summary that is going to be shared via facebook and google plus but for some reason facebook and googleplus only picks up the url and does not show the title and summary that I provided in st_title and st_summary variable.

Added this to head.

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "1234"});</script>

In my html I have something like this

<span class='st_facebook' st_url="http://www.cnn.com" st_title="CNN-Test Website" st_summary="Shared CNN news"></span>
<span class='st_googleplus' st_url="http://www.cnn.com" st_title="CNN-Test Website" st_summary="Shared CNN news"></span>

Also I cannot use opengraph (meta og tags). I have also tried javascript to set the title and summary but still the result is the same.

like image 530
ZKK Avatar asked Feb 26 '13 13:02

ZKK


1 Answers

Well I also bumped when it came to this one, you are not getting the share title and custom url in facebook shares becuase facebook does'nt consider the attributes of the span element when getting these values. Facebook uses the Open Graph Concept and crawls info from the meta tag of the website whose url is provided in the og:url meta tag.To allow facebook to show your titles and custom url do the following :

1.Make sure you add the line "shorten:false" in the stLight.options javascript,otherwise you will not get the full website url 2.Add these tags to your head section : (you can add these along with your existing meta tags)

<meta property="og:title" content="Yor desired title"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="Your website url"/>
<meta property="og:image" content="your custom image path"/>
<meta property="og:description" content="A short description of your website"/>

the image should be preferable 200X200 pixels.If you want to know more then... http://developers.facebook.com/docs/technical-guides/opengraph/built-in-objects/

Hope it helps !

like image 185
Riz Avatar answered Oct 16 '22 15:10

Riz