docs: Create path.Clean documentation

Related to #9005
This commit is contained in:
Joe Mooring 2021-10-09 11:36:57 -07:00 committed by GitHub
parent 26f1919ae0
commit f8d132d731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,26 @@
---
title: path.Clean
description: Replaces path separators with slashes (`/`) and removes extraneous separators.
date: 2021-10-08
# publishdate: 2018-11-28
# lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [path]
signature: ["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"
```