错误的og:Facebook Open Graph中的图像

时间:2013-02-10 04:15:57

标签: facebook wordpress opengraph

我在我的网站上做了Open Graph,一切都很完美。

但是,对于主页(front_page),facebook会拍摄FOOTER(?!)的图像

在调试中没问题。如何强制Facebook将OG:IMAGE作为第一张图片?

代码:

<?php if (have_posts()):while(have_posts()):the_post(); endwhile; endif;?>
<!-- the default values -->
<meta property="fb:app_id" content="MY ID" />

<!-- if page is home -->
<?php if (is_front_page()) { ?>
<meta property="og:title" content="name" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://www.com/"/>
<meta property="og:image" content="http://www.com/wp-content/uploads/2013/02/thumbface.jpg" /> <?php } ?>

<!-- if page is content page -->
<?php if (is_single()) { ?>
<meta property="og:title" content="<?php single_post_title(''); ?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php the_permalink() ?>"/>
<meta property="og:description" content="<?php echo strip_tags(get_the_content($post->ID)); ?>" />
<meta property="og:image" content="<?php $fbthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'facebook-thumb' ); echo $fbthumb[0]; ?>" />

<!-- if page is others -->
<?php } else { ?>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php bloginfo('description'); ?>" />
<meta property="og:image" content="http://www.com/wp-content/uploads/2013/02/thumbface.jpg" /> <?php } ?>

抱歉我的英文不好

1 个答案:

答案 0 :(得分:0)

调试Facebook's Debug Tool上的网址。即使图像是正确的,您的URL也可能已被Facebook缓存。使用Linter将删除缓存,并使用页面上当前可用的标签。