Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic OpenGraph Object URL not working

I am trying to post an open graph activity. Actually it's working with a static .html file. But if i point to a url with url params i get an error. The sourcecode on both pages is 100% the same, trust me.

# Dynamic call
/me/somesandbox:drive?car=http://www.domain.com/object/?og:type=somesandbox:car&og:title=Some%20car

# Static call
/me/somesandbox:drive?car=http://www.domain.com/static_car.html

Error:
"Object at URL 'http://www.domain.com/object/?og:type' of type 'website' is invalid because a required property 'og:type' of type 'string' was not provided."

If you look at the error, you ll see, that Facebook didnt get the whole url. The params are missing, right. Please help!

like image 779
fabian Avatar asked Feb 04 '12 14:02

fabian


1 Answers

The Open Graph object url you are trying to use is this?

http://www.domain.com/object/?og:type=somesandbox:car&og:title=Some%20car

My guess is, since Facebook is already parsing : colon characters for the action names (i.e. graph.facebook.com/me/recipebox:cook?recipe=), they might not be safe to use as your own parameters.

Also, there might be some confusion: so far as I know, Open Graph properties of objects are not passed in URLs like this og:title=Some%20car. They are actually uncoded in the page the URL points to, via the open graph meta tags: <meta property="og:title" content="Some car" />. So if you trying to set the Object properties with the URL, it won't work.

Don't forget to use the Lint Debug Tool to test out your Open Graph Object URLs!

You probably do know this, though, and are just using the URL's GET parameters to set the meta tags. Something like this?

<meta property="og:title" content="<? echo $_GET['og:title'] ?>" />

If this is the case, just try it without the : colons. There is some debate about whether they are safe in URLs anyway, but if Facebook is also parsing them it'll be safest to just leave them out, like this:

// http://www.domain.com/object/?ogtype=somesandbox:car&ogtitle=Some%20car
<meta property="og:type" content="<? echo $_GET['ogtype'] ?>" />
<meta property="og:title" content="<? echo $_GET['ogtitle'] ?>" />

I have not tested this, just giving some suggestions to try. Good luck!

like image 149
thaddeusmt Avatar answered Nov 15 '22 09:11

thaddeusmt