diff --git a/middleware/robots.js b/middleware/robots.js index ac89bee965..53fa6f8abc 100644 --- a/middleware/robots.js +++ b/middleware/robots.js @@ -8,14 +8,10 @@ export default function robots(req, res, next) { res.type('text/plain') - // remove subdomain from host - // docs-internal-12345--branch-name.herokuapp.com -> herokuapp.com - const rootDomain = req.hostname.split('.').slice(1).join('.') - - // prevent crawlers from indexing staging apps - if (rootDomain === 'herokuapp.com') { - return res.send(disallowAll) + // only include robots.txt when it's our production domain and adding localhost for robots-txt.js test + if (req.hostname === 'docs.github.com' || req.hostname === '127.0.0.1') { + return res.send(defaultResponse) } - return res.send(defaultResponse) + return res.send(disallowAll) }