开发者

Does the Facebook OG Object Debugger Somehow Skip PHP?

I have a dynamic PHP page that basically displays a video. When a Facebook user clicks on the video, a timeline event is posted to their Facebook profile, but my OG meta tags don't seem to want to cooperate with the PHP variables the video information is stored in.

If I type the correct strings directly into the meta tags, everything works great, but the page by design picks a video from my Database.

These are the current tags with PHP Variables included:

<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# visiovert: http://ogp.me/ns/fb/visiovert#'>
    <meta property='fb:app_id'      content='261459743887413'> 
    <meta property='og:type'        content='visiovert:advertisement'> 
    <meta property='og:url'         content='http://visiovert.net/ad.php'>
    <meta property='og:site_name'       content='VisioVert'> 
    <?php 
    echo("<meta property=\"og:title\" content=\"".$Video->title."\" />\n");
    echo("<meta property=\"og:description\" content=\"".$Video->description."\" />\n");
    echo("<meta property=\"og:image\" content=\"".$Video->location.".jpg\" />\n");
    echo("<meta property=\"og:video\" content=\"".$Video->location.".mp4\" />\n");
    ?>
    <meta property='og:video:height' content='432' >
    <meta property='og:video:width' content='768'>
</head>

If you view the page source, this is what you can see in the header:

<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# visiovert: http://ogp.me/ns/fb/visiovert#'>
    <meta property='fb:app_id'      content='261459743887413'> 
    <meta property='og:type'        conten开发者_运维知识库t='visiovert:advertisement'> 
    <meta property='og:url'         content='http://visiovert.net/ad.php'>
    <meta property='og:site_name'       content='VisioVert'> 
    <meta property="og:title" content="Echo" />
    <meta property="og:description" content="An example video ad for VisioVert." />
    <meta property="og:image" content="http://visiovert.net/Videos/echo.jpg" />
    <meta property="og:video" content="http://visiovert.net/Videos/echo.mp4" />
    <meta property='og:video:height' content='432' >
    <meta property='og:video:width' content='768'>
</head>

That matches exactly what I would like it to, but when testing using the Facebook Object Debugger, it is not getting anything out of PHP variables. I could be missing something right in front of me...but I've looked around and haven't found an answer.


Veliisx

try adding fb namespace to your html tag.

 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#" xmlns:shawnsspace="http://www.shawnsspace.com/ns#">

p.s. in your source only half of the tags are closed. Not sure if this would be ignored but will cause errors in some browsers.


I often have issues with escaping too, have you tried something like below to avoid the heavy escaping?
The below is basicly how dynamically add my meta, i know its a bit more code to echo each but it avoids a lot of confusion with escaping.


<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# visiovert: http://ogp.me/ns/fb/visiovert#'>
    <meta property='fb:app_id'      content='261459743887413'> 
    <meta property='og:type'        content='visiovert:advertisement'> 
    <meta property='og:url'         content='http://visiovert.net/ad.php'>
    <meta property='og:site_name'       content='VisioVert'> 

<meta property="og:title" content="<?php echo $Video->title; ?>" />
<meta property="og:description" content="<?php echo $Video->description; ?>" />
<meta property="og:image" content="<?php echo $Video->location; ?>.jpg" />
<meta property="og:video" content="<?php echo $Video->location; ?>.mp4" />

    <meta property='og:video:height' content='432' >
    <meta property='og:video:width' content='768'>
</head>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜