all repos — honk @ 0afa9497fd54cc74863f786c0533a5694e12ab58

my fork of honk

default robots.txt
Ted Unangst tedu@tedunangst.com
Mon, 17 Jun 2019 13:06:54 -0400
commit

0afa9497fd54cc74863f786c0533a5694e12ab58

parent

ea05df6a47f87787a3c1c227b1abb8cb473273b1

2 files changed, 11 insertions(+), 0 deletions(-)

jump to
M docs/changelog.txtdocs/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.gohonk.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)