summaryrefslogtreecommitdiffstats
path: root/hugolib/paths/paths.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-06-13 09:52:02 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-06-13 11:40:25 +0200
commita5a4422aaeffe0e9df713cf09c73a9cc423a2e1e (patch)
tree6d3b5d6b8a2d23aa59416a00a664b772f7d24581 /hugolib/paths/paths.go
parent617e094482cbb8e46e5606bc7ff5ead109419d4d (diff)
Fix relURL with leading slash when baseURL includes a subdirectory
Fixes #9994
Diffstat (limited to 'hugolib/paths/paths.go')
-rw-r--r--hugolib/paths/paths.go15
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"),