HUGO
News Docs Themes Community GitHub

path.Base

Replaces path separators with slashes (/) and returns the last element of the given path.

Syntax

path.Base PATH

Returns

string
{{ path.Base "a/news.html" }} → news.html
{{ path.Base "news.html" }} → news.html
{{ path.Base "a/b/c" }} → c
{{ path.Base "/x/y/z/" }} → z
{{ path.Base "" }} → .

Last updated: January 1, 0001
Improve this page