Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

robots.js 547 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  1. const defaultResponse = 'User-agent: *'
  2. const disallowAll = `User-agent: *
  3. Disallow: /`
  4. module.exports = function robots (req, res, next) {
  5. if (req.path !== '/robots.txt') return next()
  6. res.type('text/plain')
  7. // remove subdomain from host
  8. // docs-internal-12345--branch-name.herokuapp.com -> herokuapp.com
  9. const rootDomain = req.hostname.split('.').slice(1).join('.')
  10. // prevent crawlers from indexing staging apps
  11. if (rootDomain === 'herokuapp.com') {
  12. return res.send(disallowAll)
  13. }
  14. return res.send(defaultResponse)
  15. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...