diff --git a/posts.go b/posts.go index 259d960..9f56969 100644 --- a/posts.go +++ b/posts.go @@ -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, }, }) diff --git a/utils.go b/utils.go index 4848e13..c323844 100644 --- a/utils.go +++ b/utils.go @@ -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 +}