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
1 changed files with 10 additions and 2 deletions

View File

@ -12,8 +12,16 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//serve robots.txt
args.app.get('/robots.txt', function(req, res)
{
var filePath = path.normalize(__dirname + "/../../../static/robots.txt");
res.sendfile(filePath);
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);
}
});
});
//serve favicon.ico