robots.txt

This commit is contained in:
Flummi 2021-12-24 11:15:30 +01:00
parent 99598d9bb3
commit f1a8c0cabc
2 changed files with 14 additions and 0 deletions

6
public/robots.txt Normal file
View File

@ -0,0 +1,6 @@
User-agent: *
Disallow: /tag
Disallow: /user
Disallow: /audio
Disallow: /video
Disallow: /image

View File

@ -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")
});
});
};