mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
475f87f685
30f32a624 Update scss-sass.md 503130186 Update scss-sass.md cbfaa6704 Remove references to outdated Blackfriday markdown processor (#1748) e43948d26 netlify: Hugo 0.100.2 aaabe0ee9 Merge branch 'tempv0.100.2' bc615f257 tpl/path: Add path.BaseName function 5dddbf95e Add Chinese translation for _documentation and _index.md b1e4f3200 Add translation for search tools 23281633a Update introduction.md 3abb5fb5d netlify: Hugo 0.100.1 644ed3b01 Update faq.md 54f377051 Add some lines about resources.Copy 82cf08355 Remove most Blackfriday references bfbe5aaf3 netlify: Update to Hugo 0.100.0 8b6f8577f docs: Regen CLI docs 858a5d39c docs: Regen docs helper 5037d504f Merge commit 'e4bfe59c4e043c92d3992587d8c64d264b262a22' 03ca7be5b Fix indentation in highlight shortcode git-subtree-dir: docs git-subtree-split: 30f32a62433a6d62b680a2dd874c72bb8fb0b728
27 lines
718 B
Markdown
27 lines
718 B
Markdown
---
|
|
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, clean]
|
|
signature: ["path.Clean PATH"]
|
|
relatedfuncs: [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"
|
|
```
|