aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/content/en/functions/urls/JoinPath.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/functions/urls/JoinPath.md')
-rw-r--r--docs/content/en/functions/urls/JoinPath.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/content/en/functions/urls/JoinPath.md b/docs/content/en/functions/urls/JoinPath.md
new file mode 100644
index 000000000..7acecb506
--- /dev/null
+++ b/docs/content/en/functions/urls/JoinPath.md
@@ -0,0 +1,30 @@
+---
+title: urls.JoinPath
+description: 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.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/path/Join
+ returnType: string
+ signatures: [urls.JoinPath ELEMENT...]
+aliases: [/functions/urls.joinpath]
+---
+
+{{< new-in 0.112.0 >}}
+
+```go-html-template
+{{ 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.
+
+[`path.Join`]: /functions/path/join