mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
---
|
||||
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"
|
||||
parent: functions
|
||||
keywords: [path, clean]
|
||||
signature: ["path.Clean PATH"]
|
||||
relatedfuncs: [path.Base, path.BaseName, path.Dir, path.Ext, path.Join, path.Split]
|
||||
@@ -15,13 +12,13 @@ relatedfuncs: [path.Base, path.BaseName, path.Dir, path.Ext, path.Join, path.Spl
|
||||
|
||||
`path.Clean` replaces path separators with slashes (`/`) and removes extraneous separators, including trailing separators.
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ path.Clean "foo//bar" }} → "foo/bar"
|
||||
{{ path.Clean "/foo/bar/" }} → "/foo/bar"
|
||||
```
|
||||
|
||||
On a Windows system, if `.File.Path` is `foo\bar.md`, then:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ path.Clean .File.Path }} → "foo/bar.md"
|
||||
```
|
||||
|
Reference in New Issue
Block a user