Debian Codegraph @

docs/content/en/functions/urls/JoinPath.md

raw
1 ---
2 title: urls.JoinPath
3 description: Returns a URL string created by joining the provided elements and cleaning the result of any ./ or ../ elements, or an empty string if the argument list is empty.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: string
10 signatures: [urls.JoinPath ELEMENT...]
11 aliases: [/functions/urls.joinpath]
12 ---
13
14 ```go-html-template
15 {{ urls.JoinPath }} → "" (empty string)
16 {{ urls.JoinPath "" }} → /
17 {{ urls.JoinPath "a" }} → a
18 {{ urls.JoinPath "a" "b" }} → a/b
19 {{ urls.JoinPath "/a" "b" }} → /a/b
20 {{ urls.JoinPath "https://example.org" "b" }} → https://example.org/b
21
22 {{ urls.JoinPath (slice "a" "b") }} → a/b
23 ```
24
25 Unlike the [`path.Join`][] function, `urls.JoinPath` retains consecutive leading slashes.
26
27 [`path.Join`]: /functions/path/join/