From 4d53696ae0f32798947ad98a5a873477f5116662 Mon Sep 17 00:00:00 2001 From: Joe Lanman Date: Fri, 27 Jan 2017 18:34:50 +0000 Subject: [PATCH] allow search indexing in promo mode --- server.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/server.js b/server.js index 1e71e32080..1d4d0ce554 100644 --- a/server.js +++ b/server.js @@ -111,24 +111,31 @@ app.locals.promoMode = promoMode app.locals.releaseVersion = 'v' + releaseVersion app.locals.serviceName = config.serviceName -// Disallow search index idexing -app.use(function (req, res, next) { - // Setting headers stops pages being indexed even if indexed pages link to them. - res.setHeader('X-Robots-Tag', 'noindex') - next() -}) - -app.get('/robots.txt', function (req, res) { - res.type('text/plain') - res.send('User-agent: *\nDisallow: /') -}) - // Redirect root to /docs when in promo mode. if (promoMode === 'true') { console.log('Prototype kit running in promo mode') + app.get('/', function (req, res) { res.redirect('/docs') }) + + // allow search engines to index the prototype kit promo site + app.get('/robots.txt', function (req, res) { + res.type('text/plain') + res.send('User-agent: *\nAllow: /') + }) +} else { + // Disallow search index idexing + app.use(function (req, res, next) { + // Setting headers stops pages being indexed even if indexed pages link to them. + res.setHeader('X-Robots-Tag', 'noindex') + next() + }) + + app.get('/robots.txt', function (req, res) { + res.type('text/plain') + res.send('User-agent: *\nDisallow: /') + }) } // routes (found in app/routes.js)