我正在尝试将Facebook共享按钮集成到我的雇主的网站,标题,网址,说明/介绍都正确显示,但没有附加图像.当共享对话框打开时,图像容器会闪烁然后消失,就像facebook正在尝试处理图像但失败一样.
我正在使用og:image和链接关系来尝试指定用于共享链接的图像:
<meta property="og:image" content="/images/logo_white_150px.png" />
<link rel="image_src" type="image/png" href="/images/logo_white_150px.png" />
Run Code Online (Sandbox Code Playgroud)
该图像曾经工作(它适当缩放)但不再适用,我也尝试过其他不同尺寸和格式的图像而没有运气.
这是我在标题中使用的开放元标记:
<!DOCTYPE html>
<html xmlns:fb="http://ogp.me/ns/fb#" itemscope itemtype="http://schema.org/Article" xmlns:og="http://ogp.me/ns#">
<head>
<meta property="og:type" content="landing page" />
<meta property="og:title" content="Social Media Test Page" />
<meta property="og:description" content="This is a page for testing the behavior of social media buttons..." />
<meta property="og:image" content="/images/logo_white_150px.png" />
<link rel="image_src" type="image/png" href="/images/logo_white_150px.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:url" content="<%=shortUrl%>" />
<meta property="og:site_name" content="site name" />
<meta property="og:medium" content="mult" />
</head>
Run Code Online (Sandbox Code Playgroud)
这是我在身体开始时使用的JavaScript:
<body>
<script type="text/javascript">
(function(d, …Run Code Online (Sandbox Code Playgroud)