diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-09-21 19:39:10 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-09-21 19:39:10 -0400 |
commit | 1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19 (patch) | |
tree | 14aa87f32a82081f917d137775e3de01522c809e /cmd | |
parent | b72d7c201ab34bd4de9582be891c3d4b76c3fd70 (diff) | |
download | gitea-1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19.tar.gz gitea-1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19.zip |
Support custom robots.txt
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/web.go b/cmd/web.go index 83dfca4e67..a5ebf259ea 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -364,6 +364,15 @@ func runWeb(*cli.Context) { r.Any("/:reponame/*", ignSignInAndCsrf, repo.Http) }) + // robots.txt + m.Get("/robots.txt", func(ctx *middleware.Context) { + if setting.HasRobotsTxt { + ctx.ServeFile(path.Join(setting.CustomPath, "robots.txt")) + } else { + ctx.Error(404) + } + }) + // Not found handler. m.NotFound(routers.NotFound) |