Debian Codegraph @

docs/content/en/functions/path/BaseName.md

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