path.Clean
Syntax
path.Clean PATH
path.Clean replaces path separators with slashes (/) and removes extraneous separators, including trailing separators.
{{ path.Clean "foo//bar" }} → "foo/bar"
{{ path.Clean "/foo/bar/" }} → "/foo/bar"
On a Windows system, if .File.Path is foo\bar.md, then:
{{ path.Clean .File.Path }} → "foo/bar.md"