Search code examples
facebook-opengraphyammersalesforce-chatterjive

How to serve OpenGraph for a private page


we'd like to implement OpenGraph on an intranet application, so that when people share a URL from the application into a social network (Yammer, Jive, Chatter ...), it would show a nice thumbnail, description, and so forth.

The problem: because Yammer is not connected to the intranet, it follows the redirections and serves OpenGraph data from the login page...

Is there a way to behave properly in such a case ?

We've come up with 3 possible solutions:

  • Implement an unknown but possibly existing part of the OpenGraph protocol, to serve private pages, ignoring as well as possible the redirections
  • Doing some kind of cloaking - detecting the agent is Yammer or Chatter, and serve a dedicated page
  • Keeping the OpenGraph meta data in some kind of session, and serves them from the login page (where the social network eventually ends up...)

Thanks for your input if you've been confronted to this problem too !


Solution

  • Third solution sounds like the best one. Since it is allowed (by your rules) to show part of a data outside your intranet, you have to add individual thumbnail and description in the meta tags of login page.

    • If a user is logged in, he can see all the data from page yoursite.com/username/post123/ (as usual),
    • But if user is not logged in (like any bot), he will see login form (with thumbnail and description in meta tags) on the same address yoursite.com/username/post123/
    • So all bots will see proper OG data, all users will be able to login as usual.

    (i.e. you shouldn't redirect not logged in visitors to the page yoursite.com/loginpage. You have to show a login form on all such pages)