How do I prevent an image from showing up as a thumbnail option when my site is shared on Facebook?
When a user shares my site on Facebook, Facebook allows them to select a thumbnail image to go along with the share. I'd like the only image made available to be my site logo, but I'm not sure what the best way to accomplish this is.
So for example, this should show up as an option:
<img src="logo.png" />
But I'd like other images to be ignored:
<开发者_运维百科;img src="news1.jpg" />
<img src="news2.jpg" />
<img src="footerDetail.jpg" />
Hey, that's quite easy, you just need to specify and open graph metatag in your page.
For you it would be as simple as adding this to your page HEAD :
<meta property="og:image" content="YOUR_IMAGE_URL"/>
You can find a complete reference of open graphs metatags here : http://developers.facebook.com/docs/opengraph/
And you can test if facebook find your image correctly here : http://developers.facebook.com/tools/lint
(You need to test it using the second link so that facebook will refresh its cached informations about your site).
Cheers :)
Just did this for another app: the opengraph links actually didn't work for me.
What worked was was adding a line like this
<link rel="image_src" href="http://{site hostname}/{path to icon}" />
to the HEAD of the page. I added the opengraph tags anyway, but so far the image_src has performed perfectly.
精彩评论