hugo/docs/content/en/functions/path/Clean.md
2023-10-20 09:43:56 +02:00

787 B

title description categories keywords menu function relatedFunctions aliases
path.Clean Replaces path separators with slashes (`/`) and removes extraneous separators.
functions
docs
parent
functions
aliases returnType signatures
string
path.Clean PATH
path.Base
path.BaseName
path.Clean
path.Dir
path.Ext
path.Join
path.Split
/functions/path.clean

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"