From 5a3bdefbda50aafb82d70564446a44025c7c7684 Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Sun, 19 May 2019 22:24:54 +0200 Subject: [PATCH] robots.txt --- res/static/robots.txt | 4 ++++ webcontroller/web_controller.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 res/static/robots.txt diff --git a/res/static/robots.txt b/res/static/robots.txt new file mode 100644 index 0000000..ea0d5e6 --- /dev/null +++ b/res/static/robots.txt @@ -0,0 +1,4 @@ +User-Agent: * +Disallow: /res/ +Disallow: /u/ +Disallow: /l/ diff --git a/webcontroller/web_controller.go b/webcontroller/web_controller.go index 303396f..3ff33c3 100644 --- a/webcontroller/web_controller.go +++ b/webcontroller/web_controller.go @@ -51,6 +51,7 @@ func New(r *httprouter.Router, prefix string, conf *conf.PixelWebConfig) *WebCon // General navigation r.GET(p+"/" /* */, wc.serveTemplate("home", false)) r.GET(p+"/favicon.ico" /* */, wc.serveFile("/favicon.ico")) + r.GET(p+"/robots.txt" /* */, wc.serveFile("/robots.txt")) r.GET(p+"/api" /* */, wc.serveTemplate("apidoc", false)) r.GET(p+"/history" /* */, wc.serveTemplate("history_cookies", false)) r.GET(p+"/u/:id" /* */, wc.serveFileViewer) @@ -111,7 +112,7 @@ func (wc *WebController) serveFile(path string) httprouter.Handle { r *http.Request, p httprouter.Params, ) { - http.ServeFile(w, r, wc.staticResourceDir+"/favicon.ico") + http.ServeFile(w, r, wc.staticResourceDir+path) } }