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

发布于 2024-12-28 23:00:43 字数 230 浏览 2 评论 0原文

我正在制作一个网站图库页面,并且在元标记中我设置了一个 og:image,因此当有人在页面上单击“喜欢”时,该图像将用作他们的 Facebook 墙上的故事缩略图。

当有人共享链接时,他们只能选择使用上面的图像作为故事的缩略图。有没有办法添加更多图像作为故事缩略图的选项,以便用户可以使用箭头并选择他们想要的图像?

如果我使用多个 og:image 标签,他们会有这个选项吗?如果是这样,如何选择点赞按钮的缩略图?

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.

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? And if so, how would the like button's thumbnail image be selected?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何处潇湘 2025-01-04 23:00:43

要在 Facebook 上获取多图像选择器,您需要从请求的页面中删除 og:image 并只包含一堆 img 标记。

Facebook 将抓取所有 img 标签并提供它们作为选择。

要检测 facebook scraper,并显示特定于抓取的不同内容,只需检测下面的用户代理,并输出不同的内容(即仅您想要的 og 标签和一组 img 标签):

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

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 will scrape all the img tags and offer them as choices.

To detect the facebook scraper, and show different content specific for the scrape, just detect the user agent below, and output different content (i.e. only the og tags you want, and a set of img tags):

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文