diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..2de34a4 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,6 @@ +User-agent: * +Disallow: /tag +Disallow: /user +Disallow: /audio +Disallow: /video +Disallow: /image diff --git a/src/inc/routes/static.mjs b/src/inc/routes/static.mjs index 63c8442..90f3bde 100644 --- a/src/inc/routes/static.mjs +++ b/src/inc/routes/static.mjs @@ -1,4 +1,5 @@ import path from "path"; +import { promises as fs } from "fs"; export default (router, tpl) => { router.static({ @@ -20,4 +21,11 @@ export default (router, tpl) => { dir: path.resolve() + "/public/ca", route: /^\/ca\// }); + + router.get(/^\/robots\.txt$/, async (req, res) => { + res.reply({ + type: "text/plain", + body: await fs.readFile(path.resolve() + "/public/robots.txt", "utf-8") + }); + }); };