| 1 |
--- |
| 2 |
title: path.Base |
| 3 |
description: Returns the last element of the given path, after replacing path separators with slashes (`/`). |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [] |
| 9 |
returnType: string |
| 10 |
signatures: [path.Base PATH] |
| 11 |
aliases: [/functions/path.base] |
| 12 |
--- |
| 13 |
|
| 14 |
```go-html-template |
| 15 |
{{ path.Base "a/news.html" }} → news.html |
| 16 |
{{ path.Base "news.html" }} → news.html |
| 17 |
{{ path.Base "a/b/c" }} → c |
| 18 |
{{ path.Base "/x/y/z/" }} → z |
| 19 |
{{ path.Base "" }} → . |
| 20 |
``` |