aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/paths
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-06-13 09:52:02 +0200
committerBjørn Erik Pedersen <[email protected]>2022-06-13 11:40:25 +0200
commita5a4422aaeffe0e9df713cf09c73a9cc423a2e1e (patch)
tree6d3b5d6b8a2d23aa59416a00a664b772f7d24581 /hugolib/paths
parent617e094482cbb8e46e5606bc7ff5ead109419d4d (diff)
downloadhugo-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.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"),