简体   繁体   English

如何指定要用作Facebook共享缩略图的图像

[英]How to specify images to be used as thumbnails for facebook sharing

I am making a website gallery page, and in the meta tags I have set an og:image, so when someone clicks like on the page, the image is used as the story's thumbnail on their facebook wall. 我正在创建一个网站库页面,并且在元标记中我设置了一个og:图像,所以当有人点击页面上的图像时,图像将用作Facebook墙上的故事缩略图。

When someone shares a link, they only have the option to use the image above as the story's thumbnail. 当有人共享链接时,他们只能选择将上面的图像用作故事的缩略图。 Is there a way to add more images as options for the story's thumbnail so the user can use the arrows and select the image they want? 有没有办法添加更多图像作为故事缩略图的选项,以便用户可以使用箭头并选择他们想要的图像?

If I used more than one og:image tags, would they have that option? 如果我使用了多个og:image标签,他们会有这个选项吗? And if so, how would the like button's thumbnail image be selected? 如果是这样,那么按钮的缩略图图像将如何被选中?

To get the multi image selector on Facebook, you would need to remove the og:image from the page being requested and just have a bunch of img tags. 要在Facebook上获取多图像选择器,您需要从所请求的页面中删除og:image ,并且只需要一堆img标记。

Facebook will scrape all the img tags and offer them as choices. Facebook将刮掉所有img标签并提供它们作为选择。

To detect the facebook scraper, and show different content specific for the scrape, just detect the user agent below, and output different content (ie only the og tags you want, and a set of img tags): 要检测Facebook刮刀,并显示特定于刮擦的不同内容,只需检测下面的用户代理,并输出不同的内容(即只输出您想要的og标签和一组img标签):

facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM