From ebaa625ff385caa813f7eed38a97a9cf879656d0 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 9 Apr 2022 18:22:46 -0500 Subject: auto generate robots.txt --- scripts/updateRobots.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/updateRobots.js (limited to 'scripts/updateRobots.js') diff --git a/scripts/updateRobots.js b/scripts/updateRobots.js new file mode 100644 index 0000000..9b16bf1 --- /dev/null +++ b/scripts/updateRobots.js @@ -0,0 +1,16 @@ +import fs from 'fs' +import dotenv from 'dotenv' + +dotenv.config() + +let robotsTxt = '' + +if (process.env.IS_MIRROR) { + robotsTxt += `User-agent: *\nDisallow: /\n` +} + +await fs.promises.writeFile( + 'static/robots.txt', + robotsTxt, + { encoding: 'utf8' } +) \ No newline at end of file -- cgit