~nromdotcom/gemif

f0b44e2bba4de44664e08e62af70adaeed9ae611 — Norm MacLennan 11 months ago d1e6890
Add robots.txt to keep bots away from the games
2 files changed, 6 insertions(+), 0 deletions(-)

M pkg/gemserver/router.go
M pkg/gemserver/routes.go
M pkg/gemserver/router.go => pkg/gemserver/router.go +1 -0
@@ 33,6 33,7 @@ func StartRouter(gm *gamemanager.GameManager, gc ServerConfig) {
	g.Handle("/", handleHome(gm))
	g.Handle("/game/:statetoken", handleGame(gm, sceneRenderer))
	g.Handle("/docs*", handleStatic)
	g.Handle("/robots.txt", handleRobots)

	panic(g.Run(fmt.Sprintf(":%d", gc.Port), gc.CertFile, gc.KeyFile))
}

M pkg/gemserver/routes.go => pkg/gemserver/routes.go +5 -0
@@ 89,3 89,8 @@ func handleGame(gm *gamemanager.GameManager, renderer scenerenderer.Template) fu
		})
	}
}

func handleRobots(c gig.Context) error {
	return c.Text(`User-agent: *
Disallow: /game/`)
}