diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index e98d94f7ca..da328ded45 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -697,6 +697,16 @@ func Home(ctx *context.Context) {
return
}
+ Wiki(ctx)
+}
+
+// Code render repository page
+func Code(ctx *context.Context) {
+ checkHomeCodeViewable(ctx)
+ if ctx.Written() {
+ return
+ }
+
renderCode(ctx)
}
diff --git a/routers/web/web.go b/routers/web/web.go
index df09957b4a..aa946dd343 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -1042,11 +1042,11 @@ func RegisterRoutes(m *web.Route) {
}, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader)
m.Group("/src", func() {
- m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.Home)
- m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.Home)
- m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.Home)
+ m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.Code)
+ m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.Code)
+ m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.Code)
// "/*" route is deprecated, and kept for backward compatibility
- m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.Home)
+ m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.Code)
}, repo.SetEditorconfigIfExists)
m.Group("", func() {
@@ -1067,6 +1067,7 @@ func RegisterRoutes(m *web.Route) {
m.Group("/{username}", func() {
m.Group("/{reponame}", func() {
m.Get("", repo.SetEditorconfigIfExists, repo.Home)
+ m.Get("/code", repo.SetEditorconfigIfExists, repo.Code)
}, ignSignIn, context.RepoAssignment, context.RepoRef(), context.UnitTypes())
m.Group("/{reponame}", func() {
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index 13c76de5aa..4948d90379 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -178,7 +178,7 @@
{{ end }}
{{if .Permission.CanRead $.UnitTypeCode}}
-
+
{{svg "octicon-code"}} {{.i18n.Tr "repo.code"}}
{{end}}