all repos — legit @ 089ada4cac4dd900646c2039960214f549bed058

web frontend for git

config: fix go-import pretty url
Anirudh Oppiliappan x@icyphox.sh
Sun, 18 Dec 2022 21:00:36 +0530
commit

089ada4cac4dd900646c2039960214f549bed058

parent

0e6eaa211357cd5b9de1762b1cb49e47d35580dc

2 files changed, 7 insertions(+), 4 deletions(-)

jump to
M config/config.goconfig/config.go

@@ -23,7 +23,7 @@ Description string `yaml:"description"`

} `yaml:"meta"` Misc struct { GoImport struct { - PrettyURL string `yaml:"string"` + PrettyURL string `yaml:"prettyURL"` } `yaml:"goImport"` } `yaml:"misc"` Server struct {
M routes/routes.goroutes/routes.go

@@ -114,13 +114,16 @@ return

} 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))