hugo/docs/content/en/functions/urls/JoinPath.md
2023-10-20 09:43:56 +02:00

887 B

title description categories keywords menu function relatedFunctions 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.
functions
docs
parent
functions
aliases returnType signatures
string
urls.JoinPath ELEMENT...
path.Join
urls.JoinPath
/functions/urls.joinpath
{{ urls.JoinPath }} → ""
{{ 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.