path.Join.md (783B)
1 ---
2 title: path.Join
3 description: Join path elements into a single path.
4 date: 2018-11-28
5 publishdate: 2018-11-28
6 lastmod: 2018-11-28
7 categories: [functions]
8 menu:
9 docs:
10 parent: "functions"
11 keywords: [path, join]
12 signature: ["path.Join ELEMENT..."]
13 workson: []
14 hugoversion: "0.39"
15 relatedfuncs: [path.Base, path.BaseName, path.Clean, path.Dir, path.Ext, path.Split]
16 deprecated: false
17 ---
18
19 `path.Join` joins path elements into a single path, adding a separating slash if necessary.
20 All empty strings are ignored.
21
22 **Note:** All path elements on Windows are converted to slash ('/') separators.
23
24 ```
25 {{ path.Join "partial" "news.html" }} → "partial/news.html"
26 {{ path.Join "partial/" "news.html" }} → "partial/news.html"
27 {{ path.Join "foo/baz" "bar" }} → "foo/baz/bar"
28 ```