We need to store a robots.txt on our CMS site but we are not sure exactly where this file should live. Can anyone assist?
Following this, I also need to place a robots with disallow: / because I don't want search engines to crawl the backend of the site
This can be done via Express. You can add this to your
server.ts
:
app.get('/robots.txt', (_, res) => {
res.type('text/plain')
res.send('User-agent: *\nDisallow: /')
})
Modify as needed
Star
Discord
online
Get dedicated engineering support directly from the Payload team..