开发者

Facebook Like Meta Tags not showing Images [duplicate]

开发者 https://www.devze.com 2023-02-01 20:19 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How does Facebook Sharer select Images?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How does Facebook Sharer select Images?

I have implemented the Facebook Like button on all our pages and it works properly by posting to Facebook with the correct meta tags. However, the images do not开发者_运维百科 show in Facebook. The image meta tags show up properly when I use the Facebook Linter, but they don't show on someone's facebook page where the Like is posted on their wall. Also, is there any way to have the info recache more often? The tags take forever to update. Our site is built with CakePHP. Below are snippets of my code, thanks:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="http://www.facebook.com/2008/fbml">
<head> 
    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    <script type="text/javascript" src="http://use.typekit.com/wlx8xgm.js"></script>
    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
    <?php 
    if(!isset($meta_title)) {
        $meta_title = $title_for_layout;
    }
    if(!isset($meta_location)) {
        $meta_location = null;
    }
    if(!isset($meta_image)) {
        $meta_image = null;
    }
    if(!isset($meta_type)) {
        $meta_type = null;
    }
    ?>

    <meta property="og:title" content="<?= $meta_title ?>"/>
    <meta property="og:type" content="<?= $meta_type ?>"/>
    <meta property="og:url" content="<?= $meta_location ?>"/>
    <meta property="og:image" content="<?= $meta_image ?>"/>
    <meta property="fb:admins" content="1004432800"/>

...

echo '<br><br><fb:like href="' . $fbook_url . '" width="300" height="80" layout="standard" show_faces="true" colorscheme="light"></fb:like>';


what type of URL are you using? relative or absolute?
Also, if it's a cache problem then just use:

<meta property="og:image" content="<?php echo $meta_image . '?' . rand(); ?>"/>

EDIT: You should use the like script from the like plugin page.

0

精彩评论

暂无评论...
验证码 换一张
取 消