From 649560fca2bcbe7edb48f67404fb4cfe76274d36 Mon Sep 17 00:00:00 2001 From: spf13 Date: Thu, 11 Jul 2013 22:55:07 -0400 Subject: proper BaseUrl handling (if has trailing slash or not) --- hugolib/config.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'hugolib/config.go') diff --git a/hugolib/config.go b/hugolib/config.go index cb54b7374..983aa254f 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -22,6 +22,7 @@ import ( "os" "path" "path/filepath" + "strings" ) // config file items @@ -65,6 +66,11 @@ func SetupConfig(cfgfile *string, path *string) *Config { c.Indexes["tag"] = "tags" c.Indexes["category"] = "categories" } + + if !strings.HasSuffix(c.BaseUrl, "/") { + c.BaseUrl = c.BaseUrl + "/" + } + return &c } -- cgit v1.2.3