Prathamesh mhatre
Prathamesh mhatre

Reputation: 1075

Google plus web share button not sharing dynamic og tags

I am trying to share some events using google plus share button. The problem I am facing is when I try to share a particular event by using the og tags where the content are hard-coded for eg :

<meta property="og:title"  content="My Title">
<meta property="og:image" content="Awesome event">
<meta property="og:description" content="http://exqlusiv.com/wp-content/uploads/2012/08/tomorrowland-2012-video-live-sets-aftermovie.png"> 

And then use the code given at https://developers.google.com/+/web/share/ to share it, Its properly working but the problem is when I pass a variables to the content of the og tags like

<meta property="og:title" content="<?php echo $title?>" />
<meta property="og:image" content="<?php echo $image?>" />
<meta property="og:description" content="<?php echo $description?>" />

The google share button do not detect the tags and not able to share the content properly. I am really stuck at this..

Any suggestion,

Thank You.

Upvotes: 0

Views: 2644

Answers (2)

Purushothaman Ramraj
Purushothaman Ramraj

Reputation: 183

For Google+, append ?v=random_string to the URL. If you are using this idea with Facebook share, make sure that the og:url param in the response matches the URL you are sharing.

For Facebook, you can also force recrawl by making a post request to https://graph.facebook.com with

{id: url,
scrape: true}

Upvotes: 0

Prisoner
Prisoner

Reputation: 50701

Make sure you have verified, both by visiting the page directly and by use of the Google Rich Data Testing Tool that the data is correctly being filled in. And while Google sharing does usually recognize og data, you may also want to consider adding Schema.org microdata which Google seems to be better at handling.

Upvotes: 3

Related Questions