Fix paths

This commit is contained in:
Jan-Lukas Else 2020-11-17 17:43:30 +01:00
parent a1cf7ff71f
commit fc6c883eca
2 changed files with 10 additions and 3 deletions

View File

@ -252,9 +252,9 @@ func serveIndex(ic *indexConfig) func(w http.ResponseWriter, r *http.Request) {
"Posts": posts,
"HasPrev": hasPrev,
"HasNext": hasNext,
"First": appConfig.Server.PublicAddress + path,
"Prev": appConfig.Server.PublicAddress + prevPath,
"Next": appConfig.Server.PublicAddress + nextPath,
"First": slashIfEmpty(path),
"Prev": slashIfEmpty(prevPath),
"Next": slashIfEmpty(nextPath),
"SummaryTemplate": summaryTemplate,
},
})

View File

@ -100,3 +100,10 @@ func resolveURLReferences(base string, refs ...string) ([]string, error) {
}
return urls, nil
}
func slashIfEmpty(s string) string {
if s == "" {
return "/"
}
return s
}