开发者

How to exclude images from the facebook like button

开发者 https://www.devze.com 2023-03-12 23:14 出处:网络
I\'m having a problem with my facebook like button and the webpage. The webpage contains banners and random images as well as the article image, now facebook have removed the share button, though it s

I'm having a problem with my facebook like button and the webpage. The webpage contains banners and random images as well as the article image, now facebook have removed the share button, though it still works, but with the current like button. Facebook chooses the image automatically, and sometimes it chooses the banners instead of the article image. Is there any alternate way instead of adding properties to the article 开发者_运维知识库images? Like exculding all the images but the article image.


This answer isn't necessarily helpful for "excluding" specific images, but you can control what Facebook scrapes off of your page via Open Graph protocol with meta tags. For example:

<meta property="og:title" content="This is my title" />
<meta property="og:type" content="activity" />
<meta property="og:url" content="http://www.mysite.com/redirect/" />
<meta property="og:image" content="http://www.mysite.com/logo.jpg" />
<meta property="og:site_name" content="I'm on Facebook!" />
<meta property="og:description" content="Hello World!" />

This will force Facebook to reference http://www.mysite.com/logo.jpg to use as thumbnail.

Additionally, my blog post on the related subject matter might help you: http://weblogs.asp.net/kon/archive/2011/06/07/trick-facebook-scrapping-of-facebook-tab-url.aspx


I had the same problem. Kon has a good suggestion, but I'd rather have Facebook use the article image and not the logo, so what I did is put all logos and ad banners as background-image through CSS.

Something like this:

<a href="AD LINK HERE" title="AD TITLE HERE"><span style="background-image: url('IMAGE OF AD'); width:Xpx; height:Xpx; display:block;"></span></a>
0

精彩评论

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

关注公众号