Fix aliases with path in baseURL
authorHelder Pereira <helfper@gmail.com>
Tue, 16 Jun 2020 23:05:53 +0000 (00:05 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 17 Jun 2020 08:52:35 +0000 (10:52 +0200)
hugolib/alias_test.go
hugolib/site_render.go

index a1736e7e8efbfb26bcaac3fdd88487d2ebe3cb52..8f3b756ec5351c6192c173f972b4b9127655c2d1 100644 (file)
@@ -52,6 +52,7 @@ func TestAlias(t *testing.T) {
                settings   map[string]interface{}
        }{
                {"/index.html", "http://example.com", "/", map[string]interface{}{"baseURL": "http://example.com"}},
+               {"/index.html", "http://example.com/some/path", "/", map[string]interface{}{"baseURL": "http://example.com/some/path"}},
                {"/index.html", "http://example.com", "/", map[string]interface{}{"baseURL": "http://example.com", "canonifyURLs": true}},
                {"/index.html", "../..", "/", map[string]interface{}{"relativeURLs": true}},
                {".html", "", ".html", map[string]interface{}{"uglyURLs": true}},
index 1d397dafa96b1073234539b8c9dfc47396bca5f5..88b5e6fb759774f15e2d751ef5fe2cb16500ea89 100644 (file)
@@ -338,7 +338,7 @@ func (s *Site) renderAliases() error {
                                if isRelative {
                                        // Make alias relative, where "." will be on the
                                        // same directory level as the current page.
-                                       basePath := path.Join(of.RelPermalink(), "..")
+                                       basePath := path.Join(p.targetPaths().SubResourceBaseLink, "..")
                                        a = path.Join(basePath, a)
 
                                } else {