mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
tpl/urls: Add JoinPath template function
See https://pkg.go.dev/net/url#JoinPath Closes #9694
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
03cb38e6c6
commit
5b3e165bad
@@ -68,6 +68,14 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.JoinPath,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ urls.JoinPath "https://example.org" "foo" }}`, `https://example.org/foo`},
|
||||
{`{{ urls.JoinPath (slice "a" "b") }}`, `a/b`},
|
||||
},
|
||||
)
|
||||
|
||||
return ns
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user