path.Base.md (712B)
1 --- 2 title: path.Base 3 description: Base returns the last element of a 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, base] 12 signature: ["path.Base PATH"] 13 workson: [] 14 hugoversion: "0.40" 15 relatedfuncs: [path.BaseName, path.Clean, path.Dir, path.Ext, path.Join, path.Split] 16 deprecated: false 17 --- 18 19 `path.Base` returns the last element of `PATH`. 20 21 If `PATH` is empty, `.` is returned. 22 23 **Note:** On Windows, `PATH` is converted to slash (`/`) separators. 24 25 ``` 26 {{ path.Base "a/news.html" }} → "news.html" 27 {{ path.Base "news.html" }} → "news.html" 28 {{ path.Base "a/b/c" }} → "c" 29 {{ path.Base "/x/y/z/" }} → "z" 30 ```