Should the open graph object match the user's visible page?

I defined the β€œbook” as an open graph object in my Facebook application. The book is a logical unit, and the user can view the book in several ways in the application. However, my application does not have a single URL that matches any single book.

I thought I could have a URL that splashes open metadata metadata on Facebook backstage. For example, http://www.example.com/opengrpah/object_book.php?id=3265 will return the title, author and other information for the book, but will not actually be visible to the user.

However, it looks like Facebook is using the URL of the object to act on the object. If I create an action related to a book (for example, add a book), then if someone clicks on the link in the ticker, they will go to the object_book.php URL, and not to the actual application page. This way they will see metadata, but nothing useful.

Is it for design? Of course, the object does not have to correspond to one page that the user sees. Can we have object data taken from the same URL, but show this object to the user in the context of the application?

+6
source share
3 answers

How to simply redirect from your open chart URL to the actual application page? Or how about developing your application pages to provide Open Graph metadata?

I think this can be a difficult decision.

+2
source

In the application I'm working on, we had a similar problem because it is an FB Canvas application, so if og: url for our objects is something like http://apps.facebook.com/our_namespace/?my_first_obj= 0 , then FB sees the application directly instead of the object loaded into the application. This is where we ultimately want people to land, but we had to provide a direct URL to our application, which would provide the appropriate meta tags, just like your situation. I just put this at the head of these pages:

<script> try { if (top.location.href === window.location.href) { window.location.replace("http://apps.facebook.com/our_namespace/"+window.location.search); } } catch(e) {} </script> 

So, if someone goes directly to this page, they are immediately redirected to our Canvas application, but the Facebook scraper can still get the correct metadata about the object.

0
source

I had a similar problem and I had 2 layers for my objects. One of them is the β€œmain” object, which is actually an object (a book in your case, the goal is mine). Then I have another "user" object, which is actually the link between the main object and the user. This user object has a url like mysite / user / object, and this is what I post on the fb graph with the β€œadd” action.

0
source

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


All Articles