mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
tpl/urls: Retain query and fragment with absURL and absLangURL
Closes #11772
This commit is contained in:
parent
3fc42da3d0
commit
9ea7103db7
2 changed files with 3 additions and 0 deletions
|
@ -71,6 +71,8 @@ func MakePermalink(host, plink string) *url.URL {
|
|||
}
|
||||
|
||||
base.Path = path.Join(base.Path, p.Path)
|
||||
base.Fragment = p.Fragment
|
||||
base.RawQuery = p.RawQuery
|
||||
|
||||
// path.Join will strip off the last /, so put it back if it was there.
|
||||
hadTrailingSlash := (plink == "" && strings.HasSuffix(host, "/")) || strings.HasSuffix(p.Path, "/")
|
||||
|
|
|
@ -31,6 +31,7 @@ func TestMakePermalink(t *testing.T) {
|
|||
{"http://abc.com", "bar", "http://abc.com/bar"},
|
||||
{"http://abc.com/foo/bar", "post/bar", "http://abc.com/foo/bar/post/bar"},
|
||||
{"http://abc.com/foo/bar", "post/bar/", "http://abc.com/foo/bar/post/bar/"},
|
||||
{"http://abc.com/foo", "post/bar?a=b#c", "http://abc.com/foo/post/bar?a=b#c"},
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
|
|
Loading…
Reference in a new issue