hugo/content/en/functions/urls/JoinPath.md
Bjørn Erik Pedersen 9b0050e9aa Squashed 'docs/' content from commit 5c085a37b
git-subtree-dir: docs
git-subtree-split: 5c085a37b297bf12f59efeaae591418ec025c10d
2024-01-27 10:48:33 +01:00

854 B

title description categories keywords action aliases
urls.JoinPath Joins the provided elements into a URL string and cleans the result of any ./ or ../ elements. If the argument list is empty, JoinPath returns an empty string.
aliases related returnType signatures
functions/path/Join
string
urls.JoinPath ELEMENT...
/functions/urls.joinpath

{{< new-in 0.112.0 >}}

{{ urls.JoinPath }} → "" (empty string)
{{ urls.JoinPath "" }} → /
{{ urls.JoinPath "a" }} → a
{{ urls.JoinPath "a" "b" }} → a/b
{{ urls.JoinPath "/a" "b" }} → /a/b
{{ urls.JoinPath "https://example.org" "b" }} → https://example.org/b

{{ urls.JoinPath (slice "a" "b") }} → a/b

Unlike the path.Join function, urls.JoinPath retains consecutive leading slashes.