OpenGraph object dynamic URL not working

I am trying to publish an open chart. It actually works with a static .html file. But if I point to the url with url parameters, I get an error. The source code 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:
The "Object by URL" http://www.domain.com/object/?og:type 'of type' website 'is invalid because the required property' og: type 'of type' string 'was not provided. "

If you look at the error, you will see that Facebook did not receive the entire URL. Parameters are missing, right. Please, help!

+6
source share
3 answers

The URL of the Open Graph object 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 already parses characters : colons for action names (i.e. graph.facebook.com/me/recipebox:cook?recipe= ), they should not be used as their own parameters.

In addition, there may be some confusion: as far as I know, the properties of Open Graph objects are not passed in URLs like this og:title=Some%20car . They are not actually encoded on the page the URL points to through the open meta tags : <meta property="og:title" content="Some car" /> . Therefore, if you try to set Object properties with a URL, this will not work.

Remember to use the Lint Debug Tool to check the URLs of open graphics!

You probably know this, and just use the GET URL parameters to set the meta tags. Something like that?

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

If so, just try it without a colon : There is some discussion about whether they are safe in URLs, but if Facebook parses them as well, it would be safer to just leave them, for example:

 // 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 offering some suggestions. Good luck

+4
source

Facebook has this good tool to find out what it sees on facebook: https://developers.facebook.com/tools/debug just put the URL and see the debug version.

Remember that these meta tags should be placed in a section.

0
source

Got it. @thaddeusmt: was already on the right track.

That this is super important - of course this is - you should encode uricomponent (yoururl? With = vars)

solvable

If you pass your url like this:

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

Make sure you encode url object. For instance. with javascript

 encodeURIComponent(http://www.domain.com/object/?og:type=somesandbox:car&og:title=Some%20car) 
0
source

Source: https://habr.com/ru/post/907646/


All Articles