serve facebookexternalhit user agent with spiderable #411
This change will make Spiderable serve facebookexternalhit user agent.
Using Spiderable after this change would enable one to manipulate the head tag in "client code", which would then actually be served to the Facebook bot when it comes looking for "open graph meta tags" (i.e https://developers.facebook.com/docs/opengraphprotocol/)
The main code-change is adding "facebookexternalhit" to the condition under-which the phantomjs process is initiated. Other than that there are two other complementing code-changes:
To test this:
$("head").append('<meta property="og:title" content="spidy" />');
Thanks for the patch, @ayal! This looks good.
One change I'd request, though: can you pull the 'facebookexternalhit' constant out into a list of user-agents to check for. So the test is something like "is the user-agent in this list" not "is the user-agent facebook". Then it's easier to add more later, and more clear what is going on.
Also, you'll need to sign the Meteor contributor agreement before we can merge your patch. http://contribute.meteor.com/. Thanks!
@n1mmy, see my latest commit with the "agents" list.