4
votes

I am trying to integrate opengraph in this website http://www.lsenow.com .

The person who wrote the theme used hard coded mysql instead of the functions already provided by WordPress to pull data from the database. I don't know if this is relevant. I just haven't seen that done, especially since it is unnecessary.

I am getting this message when putting this url (http://www.lsenow.com/?event=campus-tours-2) throught the debugger:

Object at URL '‎http://www.lsenow.com/‎' of type '‎events‎' is invalid because the given value '‎‎' >for property '‎og:image:url‎' could not be parsed as type '‎url‎'.

The facebook debugger is giving me this regarding the url:

Scrape Information
    Response Code‎: 200
    Fetched URL‎:   http://www.lsenow.com/?event=campus-tours-2
    Canonical URL‎: http://www.lsenow.com/

Redirect Path
    Original‎:  http://www.lsenow.com/?event=campus-tours-2
    301‎:   http://www.lsenow.com/

I tried many things, I tried:

  • < meta property="og:url" content="< ? php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?>" />'
  • < meta property="og:url" content="< ?php the_permalink() ?>
  • Adding < link rel="canonical" href="< ? php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?>"/>
  • < meta property="og:url" content="http://www.lsenow.com/?event=< ?php echo $_GET['event'];?>" />

Does anyone have a solution to this issue. I feel like I have added all the correct code.

here is what I have:

<!-------------------------- Open Graph ---------------------------->
<link rel="canonical" href="<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?>"/>
<meta property="og:url" content="http://www.lsenow.com/?event=<?php echo $_GET['event'];?>" />
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:type" content="events"/>
<meta property="og:image" content="http://placehold.it/300x300"/>
<meta property="og:site_name" content="<?php bloginfo('name');?>"/>
<meta property="og:description" content="<?php the_excerpt();?>"/>
<meta property="fb:app_id" content="151709234971178" />
<!--------------------------End of Open Graph ---------------------------->
1
Though I got the error "Object at URL '‎lsenow.com‎' of type '‎events‎' is invalid because the given value '‎‎' >for property '‎og:image:url‎' could not be parsed as type '‎url‎'." in facebook debugger, fortunately when i shared my link in FB, it fetched right image. - chank

1 Answers

1
votes

It looks like Facebook doesn't like your placehold.it url in your og:image tag. Since your URL is has a query string in it, Facebook is redirecting to your main url.

Try replacing this with a static image from your site and see if it will parse.

You might also want to take a look at your .htaccess file and your code to see if there is something in there that might be redirecting the Facebook scraper.