shithub: hugo

Download patch

ref: 9679023f2b0d7c55b70f23fd94603f301a841079
parent: 0a9172672a7f2ed85cf675c96bd01b64641256bb
author: Helder Pereira <helfper@gmail.com>
date: Tue Jun 16 20:05:53 EDT 2020

Fix aliases with path in baseURL

--- a/hugolib/alias_test.go
+++ b/hugolib/alias_test.go
@@ -52,6 +52,7 @@
 		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}},
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -338,7 +338,7 @@
 				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 {