aboutsummaryrefslogtreecommitdiffstats
path: root/modules/middleware/repo.go
diff options
context:
space:
mode:
authorNathan Zadoks <nathan@nathan7.eu>2015-10-30 13:52:36 +0100
committerNathan Zadoks <nathan@nathan7.eu>2015-10-30 14:00:09 +0100
commit4323a89c0354e4f25dbffc4b77c1e3f9ba68ba24 (patch)
tree2f9835381733f54d473556b840539a7b6000ff4a /modules/middleware/repo.go
parent102b675f96eb4340c35376ddd33385f4f20ef091 (diff)
downloadgitea-4323a89c0354e4f25dbffc4b77c1e3f9ba68ba24.tar.gz
gitea-4323a89c0354e4f25dbffc4b77c1e3f9ba68ba24.zip
Add go-source directive to repo pages
This makes Gogs repos work with godoc.org: https://github.com/golang/gddo/wiki/Source-Code-Links
Diffstat (limited to 'modules/middleware/repo.go')
-rw-r--r--modules/middleware/repo.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index ba7cbac821..6424018a20 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -347,6 +347,8 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
if ctx.Query("go-get") == "1" {
ctx.Data["GoGetImport"] = fmt.Sprintf("%s/%s/%s", setting.Domain, u.Name, repo.Name)
+ ctx.Data["GoDocDirectory"] = fmt.Sprintf("%s%s/%s/src/master{/dir}", setting.AppUrl, repo.Owner.LowerName, repo.LowerName)
+ ctx.Data["GoDocFile"] = fmt.Sprintf("%s%s/%s/src/master{/dir}/{file}#L{line}", setting.AppUrl, repo.Owner.LowerName, repo.LowerName)
}
if ctx.IsSigned {