Allow robots.txt to be custom

This commit is contained in:
John McLear 2012-11-01 13:32:04 +00:00
parent 0cbacf5b4b
commit 5629063b9c

View file

@ -12,8 +12,16 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//serve robots.txt //serve robots.txt
args.app.get('/robots.txt', function(req, res) args.app.get('/robots.txt', function(req, res)
{ {
var filePath = path.normalize(__dirname + "/../../../static/robots.txt"); var filePath = path.normalize(__dirname + "/../../../static/custom/robots.txt");
res.sendfile(filePath, function(err)
{
//there is no custom favicon, send the default robots.txt which dissallows all
if(err)
{
filePath = path.normalize(__dirname + "/../../../static/robots.txt");
res.sendfile(filePath); res.sendfile(filePath);
}
});
}); });
//serve favicon.ico //serve favicon.ico