hugo/docs/content/en/functions/path.Clean.md
2022-06-06 09:36:16 +02:00

718 B

title description date categories menu keywords signature relatedfuncs
path.Clean Replaces path separators with slashes (`/`) and removes extraneous separators. 2021-10-08
functions
docs
parent
functions
path
clean
path.Clean PATH
path.Base
path.BaseName
path.Dir
path.Ext
path.Join
path.Split

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"