Export Spiderable symbol, so people can override user agents. Also add twitterbot to agents. Fixes #1300.

This commit is contained in:
Nick Martin
2013-08-19 19:51:01 -07:00
parent dff1310cc4
commit 30b08fc012
2 changed files with 9 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ Package.on_use(function (api) {
api.use(['templating'], 'client');
api.use(['underscore'], ['client', 'server']);
api.export('Spiderable', 'server');
api.add_files('spiderable.html', 'client');
api.add_files('spiderable.js', 'server');
});

View File

@@ -9,7 +9,13 @@ Spiderable = {};
// not obey the _escaped_fragment_ protocol. The page is served
// statically to any client whos user agent matches any of these
// regexps. Users may modify this array.
Spiderable.userAgentRegExps = [/^facebookexternalhit/i, /^linkedinbot/i];
//
// An original goal with the spiderable package was to avoid doing
// user-agent based tests. But the reality is not enough bots support
// the _escaped_fragment_ protocol, so we need to hardcode a list
// here. I shed a silent tear.
Spiderable.userAgentRegExps = [
/^facebookexternalhit/i, /^linkedinbot/i, /^twitterbot/i];
// how long to let phantomjs run before we kill it
var REQUEST_TIMEOUT = 15*1000;