开发者

Facebook add thumbnail when sharing your site

How can I add a thumbnail when using the facebook.com/sharer.php?u=mysite.com? I've added this to the header: <link rel="image_src" href="http://mysite.com/image.jpg"/>

But: 1. It's not working (y开发者_如何转开发et). 2. It's not valid XHTML.

Is there anyother way or am I doing something wrong?

Thank you.


First, image dimensions matter. It must be at least 50x50 pixels, and images must be up to three times as wide as they are tall.

Second, you can use a meta tag to specify the page image, e.g. <meta property="og:image" content="http://mysite.com/image.jpg"/>

Also notice that Facebook caches pages, so if you want to be sure how Facebook handles your latest version, use their URL Linter.

See information for example here and here and here.


Facebook will get any image on the page, even hidden ones. For example:

<img rel="Facebook image" src="http://mysite.com/image.jpg" />


I've made this work by adding a display:none on any image that you want to include as a thumbnail image, facebook doesn't care what's not displayed, it only looks for tags and uses those as thumbnail options.

This works for when you want the user to select a specific image or any image on the page. Adding the line to the makes the share button only use that one specific image.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜