tpl/urls: Add JoinPath template function

See https://pkg.go.dev/net/url#JoinPath

Closes #9694
This commit is contained in:
Joe Mooring
2023-04-14 13:27:16 -07:00
committed by Bjørn Erik Pedersen
parent 03cb38e6c6
commit 5b3e165bad
4 changed files with 102 additions and 0 deletions

View File

@@ -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
}