cerca

lean forum software (pmc local branch)
Log | Files | Refs | README | LICENSE

commit cf7acdfdde0364c1a0ccd3a55b6f7bd7103f0624
parent 330526812377f02668dbf3355cfe5f401fec3354
Author: cblgh <cblgh@cblgh.org>
Date:   Tue, 11 Jan 2022 22:44:46 +0100

robots.txt

Diffstat:
Mserver/server.go | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/server/server.go b/server/server.go @@ -366,6 +366,10 @@ func (h RequestHandler) AboutRoute(res http.ResponseWriter, req *http.Request) { h.renderView(res, "about", TemplateData{LoggedIn: loggedIn}) } +func (h RequestHandler) RobotsRoute(res http.ResponseWriter, req *http.Request) { + fmt.Fprintln(res, "User-agent: *\nDisallow: /") +} + func (h RequestHandler) NewThreadRoute(res http.ResponseWriter, req *http.Request) { loggedIn, userid := h.IsLoggedIn(req) switch req.Method { @@ -427,6 +431,7 @@ func Serve(allowlist []string, sessionKey string, isdev bool) { http.HandleFunc("/register", handler.RegisterRoute) http.HandleFunc("/thread/new/", handler.NewThreadRoute) http.HandleFunc("/thread/", handler.ThreadRoute) + http.HandleFunc("/robots.txt", handler.RobotsRoute) http.HandleFunc("/", handler.IndexRoute) fileserver := http.FileServer(http.Dir("html/assets/"))