diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-06-13 09:52:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-06-13 11:40:25 +0200 |
commit | a5a4422aaeffe0e9df713cf09c73a9cc423a2e1e (patch) | |
tree | 6d3b5d6b8a2d23aa59416a00a664b772f7d24581 /hugolib/paths | |
parent | 617e094482cbb8e46e5606bc7ff5ead109419d4d (diff) | |
download | hugo-a5a4422aaeffe0e9df713cf09c73a9cc423a2e1e.tar.gz hugo-a5a4422aaeffe0e9df713cf09c73a9cc423a2e1e.zip |
Fix relURL with leading slash when baseURL includes a subdirectory
Fixes #9994
Diffstat (limited to 'hugolib/paths')
-rw-r--r-- | hugolib/paths/paths.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/hugolib/paths/paths.go b/hugolib/paths/paths.go index 501665676..e80215b92 100644 --- a/hugolib/paths/paths.go +++ b/hugolib/paths/paths.go @@ -34,6 +34,8 @@ type Paths struct { Cfg config.Provider BaseURL + BaseURLString string + BaseURLNoPathString string // If the baseURL contains a base path, e.g. https://example.com/docs, then "/docs" will be the BasePath. BasePath string @@ -145,10 +147,17 @@ func New(fs *hugofs.Fs, cfg config.Provider) (*Paths, error) { } } + var baseURLString = baseURL.String() + var baseURLNoPath = baseURL.URL() + baseURLNoPath.Path = "" + var baseURLNoPathString = baseURLNoPath.String() + p := &Paths{ - Fs: fs, - Cfg: cfg, - BaseURL: baseURL, + Fs: fs, + Cfg: cfg, + BaseURL: baseURL, + BaseURLString: baseURLString, + BaseURLNoPathString: baseURLNoPathString, DisablePathToLower: cfg.GetBool("disablePathToLower"), RemovePathAccents: cfg.GetBool("removePathAccents"), |