mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
1 KiB
1 KiB
title | description | categories | keywords | action | aliases | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
os.ReadDir | Returns an array of FileInfo structures sorted by file name, one element for each directory entry. |
|
|
The os.ReadDir
function resolves the path relative to the root of your project directory. A leading path separator (/
) is optional.
With this directory structure:
content/
├── about.md
├── contact.md
└── news/
├── article-1.md
└── article-2.md
This template code:
{{ range readDir "content" }}
{{ .Name }} → {{ .IsDir }}
{{ end }}
Produces:
about.md → false
contact.md → false
news → true
Note that os.ReadDir
is not recursive.
Details of the FileInfo
structure are available in the Go documentation.