accurat / accurapp

Create JS apps with flexible build configuration, tailored for the specific needs of Accurat
MIT License
21 stars 5 forks source link

Staging deploys should block search engines #76

Open caesarsol opened 3 years ago

caesarsol commented 3 years ago

The solution is easy: adding a robots.txt in the build dir. The problem is to be extra-sure we don't add that in production, but only in staging env!

We can't be sure about this since the same yarn build command is used, and the NODE_ENV variable is apparently not correctly set (@marcofugaro told me, but is that true?). Seems like the best option could be to use something like:

[[ ! -v GENERATE_SOURCEMAP ]] && [[ -v CI ]] && echo 'User-agent: *\nDisallow: /' > build/robots.txt
lucafalasco commented 3 years ago

This what I've done for Accurat website: https://github.com/accurat/accurat-website-cms/commit/cb84d6e673d2bb5a39dde51f7dbdd762b7db7bc0