--- title: path.BaseName description: Returns the last element of the given path with its extension removed, if present, after replacing path separators with slashes (`/`). categories: [] keywords: [] params: functions_and_methods: aliases: [] returnType: string signatures: [path.BaseName PATH] aliases: [/functions/path.basename] --- ```go-html-template {{ path.BaseName "a/news.html" }} → news {{ path.BaseName "news.html" }} → news {{ path.BaseName "a/b/c" }} → c {{ path.BaseName "/x/y/z/" }} → z {{ path.BaseName "" }} → . ```