mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-11 20:03:58 +02:00
Fix RelURL and AbsURL when path starts with language
This commit is contained in:
committed by
GitHub
parent
907d9e9268
commit
aebfe156fb
@@ -84,6 +84,21 @@ func doTestAbsURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
|
||||
{"http//foo", "http://base/path", "http://base/path/MULTIhttp/foo"},
|
||||
}
|
||||
|
||||
if multilingual && addLanguage && defaultInSubDir {
|
||||
newTests := []struct {
|
||||
input string
|
||||
baseURL string
|
||||
expected string
|
||||
}{
|
||||
{lang + "test", "http://base/", "http://base/" + lang + "/" + lang + "test"},
|
||||
{"/" + lang + "test", "http://base/", "http://base/" + lang + "/" + lang + "test"},
|
||||
}
|
||||
|
||||
for _, test := range newTests {
|
||||
tests = append(tests, test)
|
||||
}
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
v.Set("baseURL", test.baseURL)
|
||||
v.Set("contentDir", "content")
|
||||
@@ -164,6 +179,22 @@ func doTestRelURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
|
||||
{"//schemaless", "http://base/", false, "//schemaless"},
|
||||
}
|
||||
|
||||
if multilingual && addLanguage && defaultInSubDir {
|
||||
newTests := []struct {
|
||||
input string
|
||||
baseURL string
|
||||
canonify bool
|
||||
expected string
|
||||
}{
|
||||
{lang + "test", "http://base/", false, "/" + lang + "/" + lang + "test"},
|
||||
{"/" + lang + "test", "http://base/", false, "/" + lang + "/" + lang + "test"},
|
||||
}
|
||||
|
||||
for _, test := range newTests {
|
||||
tests = append(tests, test)
|
||||
}
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
v.Set("baseURL", test.baseURL)
|
||||
v.Set("canonifyURLs", test.canonify)
|
||||
|
Reference in New Issue
Block a user