diff options
-rw-r--r-- | config/config.go | 2 | ||||
-rw-r--r-- | routes/routes.go | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/config/config.go b/config/config.go index b9bcbbd..6867129 100644 --- a/config/config.go +++ b/config/config.go @@ -23,7 +23,7 @@ type Config struct { } `yaml:"meta"` Misc struct { GoImport struct { - PrettyURL string `yaml:"string"` + PrettyURL string `yaml:"prettyURL"` } `yaml:"goImport"` } `yaml:"misc"` Server struct { diff --git a/routes/routes.go b/routes/routes.go index bb0d247..1edff21 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -114,13 +114,16 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) { } cloneURL := fmt.Sprintf("https://%s/%s", d.c.Server.FQDN, name) + prettyURL := d.c.Misc.GoImport.PrettyURL - if d.c.Misc.GoImport.PrettyURL == "" { - d.c.Misc.GoImport.PrettyURL = cloneURL + if prettyURL == "" { + prettyURL = cloneURL + } else { + prettyURL = filepath.Join(prettyURL, name) } goImport := fmt.Sprintf(`<meta name="go-import" content="%s git %s">`, - d.c.Misc.GoImport.PrettyURL, cloneURL) + prettyURL, cloneURL) tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) |