Facebook 分享网址缩略图问题

标签 facebook facebook-like facebook-sharer

<分区>

Possible Duplicate:
How does Facebook Sharer select Images?

当用户在使用 http://www.facebook.com/sharer.php 的站点上使用共享按钮共享站点 url 时,想要共享缩略图实现这一目标。

网站没有 img 标签,所有图片都在 css 中定义。

我为图片添加了元标签:

<meta property="og:image" content="/images/branding/branding-logo.png"/>

<link rel="image_src" href="/images/branding/branding-logo.png"/>

但它不起作用:(

最佳答案

使用 Open Graph Meta Tags 的完整列表:

  • og:title - 实体的标题。
  • og:type - 实体的类型。您必须从开放图谱类型列表中选择一种类型。
  • og:image - 表示实体的图像的 URL。图片必须至少为 50 x 50 像素。方形图片效果最好,但您最多可以使用宽度是高度的三倍的图片。
  • og:url - 表示实体的页面的规范、永久 URL。当您使用 Open Graph 标签时,“赞”按钮会发布指向 og:url 的链接,而不是“赞”按钮代码中的 URL。
  • og:site_name - 您网站的人类可读名称,例如“IMDb”。
  • fb:admins 或 fb:app_id - 页面管理员的 Facebook ID 或 Facebook 平台应用程序 ID 的逗号分隔列表。至少,只包含您自己的 Facebook ID。

还使用绝对 URL 而不是相对 URL!

编辑:
请注意,Facebook 会在特定时期缓存网页,因此您可能不会立即注意到您的更改。检查 Facebook 是否/将实际接受您的更改的一个好方法是在您的 URL 中伪造一个参数。
例如,如果您的 URL 为:http://example.com/index.php
添加如下内容:http://example.com/index.php?123 然后在 URL Linter 中使用它. ;-)

编辑 2:
您可以直接使用 Facebook Linter(现在称为 Debugger),但请注意,在某些情况下,某些数据不能被更改,描述为here。 :

Editing Meta Tags

You can update the attributes of your page by updating your page's tags. Note that og:title and og:type are only editable initially - after your page receives 50 likes the title becomes fixed, and after your page receives 10,000 likes the type becomes fixed. These properties are fixed to avoid surprising users who have liked the page already. Changing the title or type tags after these limits are reached does nothing, your page retains the original title and type.

关于Facebook 分享网址缩略图问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4967979/

相关文章:

javascript - 为什么 Facebook 建议在 <head> 标签之外为他们的跟踪像素添加事件代码/这有什么影响?

facebook - 到期后如何在不重新加载页面的情况下获得新的访问 token ?

facebook-graph-api - 是否有 API 可以强制 Facebook 再次抓取页面?

facebook - 将自定义名称、标题、图像、描述添加到新的 Facebook 共享对话框或自定义故事中,而不是从 og meta 中获取它们

ios - iOS 上的 Facebook SDK 分享返回分享被取消

ruby-on-rails - 如何在 Facebook Canvas 上以不同方式显示我现有的 Rails 应用程序

ios - Facebook-由app_scoped_user_id打开个人资料

redirect - 如何通过 301 重定向移动 URL 并保留页面的 Facebook 点赞和 Open Graph 信息?

html - 显示重复个人资料的 Facebook 点赞框

facebook - 缺少以下必需属性 : og:url, og :type, og :title, og :image, og :description, fb:app_id