forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobots.js
More file actions
17 lines (12 loc) · 470 Bytes
/
Copy pathrobots.js
File metadata and controls
17 lines (12 loc) · 470 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const defaultResponse = 'User-agent: *'
const disallowAll = `User-agent: *
Disallow: /`
export default function robots(req, res, next) {
if (req.path !== '/robots.txt') return next()
res.type('text/plain')
// 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(disallowAll)
}