From 5629063b9cc80e23a725050c754bc06812333958 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 1 Nov 2012 13:32:04 +0000 Subject: [PATCH] Allow robots.txt to be custom --- src/node/hooks/express/specialpages.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index a5834492..50d27700 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -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