default robots.txt
Ted Unangst tedu@tedunangst.com
Mon, 17 Jun 2019 13:06:54 -0400
2 files changed,
11 insertions(+),
0 deletions(-)
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
-- v ++ Default robots.txt. + ++ A new xzone to view and import data not otherwise visible. ++ Preview before honking.
M
honk.go
→
honk.go
@@ -1315,6 +1315,14 @@ w.Header().Set("Cache-Control", "max-age="+somedays())
w.Write(data) } +func nomoroboto(w http.ResponseWriter, r *http.Request) { + io.WriteString(w, "User-agent: *\n") + io.WriteString(w, "Disallow: /t\n") + for _, u := range allusers() { + fmt.Fprintf(w, "Disallow: /u/%s/h/\n", u.Username) + } +} + func serve() { db := opendatabase() login.Init(db)@@ -1356,6 +1364,7 @@ posters := mux.Methods("POST").Subrouter()
getters := mux.Methods("GET").Subrouter() getters.HandleFunc("/", homepage) + getters.HandleFunc("/robots.txt", nomoroboto) getters.HandleFunc("/rss", showrss) getters.HandleFunc("/u/{name:[[:alnum:]]+}", showuser) getters.HandleFunc("/u/{name:[[:alnum:]]+}/h/{xid:[[:alnum:]]+}", showhonk)