hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

path.Split.md (1045B)

    1 ---
    2 title: path.Split
    3 description: Split path immediately following the final slash.
    4 date: 2018-11-28
    5 publishdate: 2018-11-28
    6 lastmod: 2018-11-28
    7 categories: [functions]
    8 menu:
    9   docs:
   10     parent: "functions"
   11 keywords: [path, split]
   12 signature: ["path.Split PATH"]
   13 workson: []
   14 hugoversion: "0.39"
   15 relatedfuncs: [path.Base, path.BaseName, path.Clean, path.Dir, path.Ext, path.Join]
   16 deprecated: false
   17 ---
   18 
   19 `path.Split` splits `PATH` immediately following the final slash, separating it into a directory and a base component.
   20 
   21 The returned values have the property that `PATH` = `DIR`+`BASE`.
   22 If there is no slash in `PATH`, it returns an empty directory and the base is set to `PATH`.
   23 
   24 **Note:** On Windows, `PATH` is converted to slash (`/`) separators.
   25 
   26 ```
   27 {{ $dirFile := path.Split "a/news.html" }} → $dirFile.Dir → "a/", $dirFile.File → "news.html"
   28 {{ $dirFile := path.Split "news.html" }} → $dirFile.Dir → "", $dirFile.File → "news.html"
   29 {{ $dirFile := path.Split "a/b/c" }} → $dirFile.Dir → "a/b/", $dirFile.File →  "c"
   30 ```