Skip to content

Commit 71f9433

Browse files
authored
Robots update (#23046)
* update to allow only if docs.github.com * update if * update for test
1 parent 9c4ef4d commit 71f9433

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

middleware/robots.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ export default function robots(req, res, next) {
88

99
res.type('text/plain')
1010

11-
// remove subdomain from host
12-
// docs-internal-12345--branch-name.herokuapp.com -> herokuapp.com
13-
const rootDomain = req.hostname.split('.').slice(1).join('.')
14-
15-
// prevent crawlers from indexing staging apps
16-
if (rootDomain === 'herokuapp.com') {
17-
return res.send(disallowAll)
11+
// only include robots.txt when it's our production domain and adding localhost for robots-txt.js test
12+
if (req.hostname === 'docs.github.com' || req.hostname === '127.0.0.1') {
13+
return res.send(defaultResponse)
1814
}
1915

20-
return res.send(defaultResponse)
16+
return res.send(disallowAll)
2117
}

0 commit comments

Comments
 (0)