add robots.txt

This commit is contained in:
Michael Stapelberg
2020-06-20 18:27:16 +02:00
parent b6463c253c
commit 15b15133e0

View File

@@ -154,6 +154,12 @@ func logic() error {
} }
}) })
mux.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, `User-agent: *
Disallow: /
`)
})
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" { if r.URL.Path != "/" {
http.Error(w, "not found", http.StatusNotFound) http.Error(w, "not found", http.StatusNotFound)