From: mahanstreamer <84676642+mahanstreamer@users.noreply.github.com> Date: Sun, 5 Sep 2021 22:34:40 +0000 (-0400) Subject: Add robots.txt file X-Git-Url: http://these/git/%22%7Burl%7D/%22https:/image.com/%7B%60%24%7BghostArchiveUrl%7D/%7BimageSrc%7D?a=commitdiff_plain;h=c1001f602a78d64228415aab1bed24d4f4e1dc7f;p=lemmy-ui.git Add robots.txt file --- diff --git a/src/server/index.tsx b/src/server/index.tsx index c95e44a..58a9691 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -28,7 +28,20 @@ server.use(express.json()); server.use(express.urlencoded({ extended: false })); server.use("/static", express.static(path.resolve("./dist"))); +const robotstxt = +`User-Agent: * +Disallow: /login +Disallow: /settings +Disallow: /create_community +Disallow: /create_post +Disallow: /inbox +Disallow: /search/ +`; // server.use(cookieParser()); +server.get("/robots.txt", async (req, res) => { + res.setHeader("content-type","text/plain; charset=utf-8") + res.send(robotstxt) +}); server.get("/*", async (req, res) => { const activeRoute = routes.find(route => matchPath(req.path, route)) || {};