ShareThis custom summary,url and title for facebook
Asked Answered
S

1

8

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.

Surculose answered 26/2, 2013 at 13:38 Comment(1)
This is probably because Facebook and Google are scraping the url you provide and using the title/description provided by the page. As far as share buttons, this can't be fixed. If you want to use the FB API, you can manually specify the url/title/description/image.Lama
P
11

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 !

Pyromania answered 10/3, 2013 at 14:9 Comment(2)
What we have to do when we are using multiple sharing button for each post in blog. I think this solution is not working thereNovitiate
If you have multiple sharing buttons in the same page, the only solution is to change the URL of each button. Each URL should point to a page where the Open Graph meta tags are properly set for the specific post/content. Edit the st_url attribute of each span tag.Endocarditis

© 2022 - 2024 — McMap. All rights reserved.