2023-04-14 16:27:16 -04:00
---
title: urls.JoinPath
2023-05-19 11:29:30 -04:00
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.
2023-04-14 16:27:16 -04:00
categories: [functions]
menu:
docs:
parent: functions
keywords: [urls,path,join]
signature: ["urls.JoinPath ELEMENT..."]
---
```go-html-template
2023-05-19 11:29:30 -04:00
{{ urls.JoinPath }} → ""
2023-04-14 16:27:16 -04:00
{{ 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/