mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
6efb279bfa
a9584e3d1 ci: bump GitHub workflow actions to latest versions f37ee374d Fix methods related to time.After a49214057 Correct heading render hook example 4b696f936 Update README.md b5a6e4039 Clean up the contributing section a5d79ed19 Fixed typo: instea → instead 6150a60e3 Remove the "local file templates" page 9395743dc Update/vendor theme 33d8c10cc Remove output format "name" parameter 7200ad97d Add security section to resources.GetRemote page 3f1e056b2 Remove erroneous front matter field 07c9a7e42 Add alpha index to glossary 6619c8aa0 Fix Page.Params example 145a92359 Simplify string concat example in math.Add 42488bb09 Add string concat example to math.Add eb20521a2 Fix flash of unstyled content with mathematical markup 74603bebe Fix typo in 'typesetting' git-subtree-dir: docs git-subtree-split: a9584e3d146c4a194d937a4dc8a37cde5ba1c618
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.