Post 尽管 og:image 元标记正确,但将 link 粘贴到 Facebook 时图像丢失
Post image missing when pasting link into Facebook despite the correct og:image meta tag
在这个 post 页面的 head 标签中(抱歉有一个语言选择提示屏幕),Yoast SEO 插件生成这个:
<meta content="http://www.example.com/wp-content/uploads/2015/06/whatever.jpg" property="og:image">
尽管此处 link 编辑的图像符合 Facebook 标准(大于 200x200 像素),但将 post link 粘贴到 Facebook 时仍然没有图像出现。我的问题是:为什么?
Facebook debugger 在 post 的基础上解决了问题,这是不可接受的,因为我的客户必须为每个新创建的 post 使用它(所有新 posts 在 FB 上分享。
我可以使用 this comment's code 使其在某种程度上起作用:
add_filter( 'wpseo_og_og_image', function ( $content ) { return $content . '?scrape=true'; } );
但是只有在FB中粘贴一个URL至少3次,每次之间刷新页面才有效,所以仍然不能接受。
你可以用这个
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="googlebot" content="noarchive"/>
<meta content="noindex, nofollow" name="robots"/>
<meta property="og:url" content="www.domain.com/img.jpg"/>
<title>loading...</title>
<script type="text/javascript" language="javascript">window.location="www.domain.com"; </script>
</head>
第一次分享post看不到图片的原因说明here:
When content is shared for the first time, the Facebook crawler will
scrape and cache the metadata from the URL shared. The crawler has to
see an image at least once before it can be rendered. This means that
the first person who shares a piece of content won't see a rendered
image
解决方案?
Pre-cache the image with the URL Debugger Run the URL through the URL debugger to pre-fetch metadata for the page. You should also do
this if you update the image for a piece of content.
Use og:image:width and og:image:height Open Graph tags Using these tags will specify the image to the crawler so that it can render it
immediately without having to asynchronously.
解决方案是添加指定图像宽度和高度的标签,参见
在这个 post 页面的 head 标签中(抱歉有一个语言选择提示屏幕),Yoast SEO 插件生成这个:
<meta content="http://www.example.com/wp-content/uploads/2015/06/whatever.jpg" property="og:image">
尽管此处 link 编辑的图像符合 Facebook 标准(大于 200x200 像素),但将 post link 粘贴到 Facebook 时仍然没有图像出现。我的问题是:为什么?
Facebook debugger 在 post 的基础上解决了问题,这是不可接受的,因为我的客户必须为每个新创建的 post 使用它(所有新 posts 在 FB 上分享。
我可以使用 this comment's code 使其在某种程度上起作用:
add_filter( 'wpseo_og_og_image', function ( $content ) { return $content . '?scrape=true'; } );
但是只有在FB中粘贴一个URL至少3次,每次之间刷新页面才有效,所以仍然不能接受。
你可以用这个
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="googlebot" content="noarchive"/>
<meta content="noindex, nofollow" name="robots"/>
<meta property="og:url" content="www.domain.com/img.jpg"/>
<title>loading...</title>
<script type="text/javascript" language="javascript">window.location="www.domain.com"; </script>
</head>
第一次分享post看不到图片的原因说明here:
When content is shared for the first time, the Facebook crawler will scrape and cache the metadata from the URL shared. The crawler has to see an image at least once before it can be rendered. This means that the first person who shares a piece of content won't see a rendered image
解决方案?
Pre-cache the image with the URL Debugger Run the URL through the URL debugger to pre-fetch metadata for the page. You should also do this if you update the image for a piece of content.
Use og:image:width and og:image:height Open Graph tags Using these tags will specify the image to the crawler so that it can render it immediately without having to asynchronously.
解决方案是添加指定图像宽度和高度的标签,参见