2019-10-21 04:22:28 -04:00
---
title: path.Join
2023-12-04 09:14:18 -05:00
description: Replaces path separators with slashes (`/`), joins the given path elements into a single path, and returns the shortest path name equivalent to the result.
categories: []
2023-10-20 03:42:39 -04:00
keywords: []
2023-12-04 09:14:18 -05:00
action:
2023-10-20 03:42:39 -04:00
aliases: []
2023-12-04 09:14:18 -05:00
related:
- functions/path/Base
- functions/path/BaseName
- functions/path/Clean
- functions/path/Dir
- functions/path/Ext
- functions/path/Split
- functions/urls/JoinPath
2023-10-20 03:42:39 -04:00
returnType: string
signatures: [path.Join ELEMENT...]
aliases: [/functions/path.join]
2019-10-21 04:22:28 -04:00
---
2023-12-04 09:14:18 -05:00
See Go's [`path.Join`] and [`path.Clean`] documentation for details.
[`path.Clean`]: https://pkg.go.dev/path#Clean
[`path.Join`]: https://pkg.go.dev/path#Join
2019-10-21 04:22:28 -04:00
2023-05-22 10:43:12 -04:00
```go-html-template
2023-12-04 09:14:18 -05:00
{{ path.Join "partial" "news.html" }} → partial/news.html
{{ path.Join "partial/" "news.html" }} → partial/news.html
{{ path.Join "foo/bar" "baz" }} → foo/bar/baz
{{ path.Join "foo" "bar" "baz" }} → foo/bar/baz
{{ path.Join "foo" "" "baz" }} → foo/baz
{{ path.Join "foo" "." "baz" }} → foo/baz
{{ path.Join "foo" ".." "baz" }} → baz
{{ path.Join "/.." "foo" ".." "baz" }} → baz
2019-10-21 04:22:28 -04:00
```