readDir
少于1分钟
将以下英文翻译为中文:
readDir
https://gohugo.io/functions/readdir/
Returns an array of FileInfo structures sorted by filename, one element for each directory entry.
语法
os.ReadDir PATH
readDir PATH
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:
| |
This template code:
| |
Produces:
| |
Note that os.ReadDir is not recursive.
Details of the FileInfo structure are available in the Go documentation.
For more information on using readDir and readFile in your templates, see Local File Templates.
另请参阅
最后修改 June 1, 2023: 新增一个配置参数:sidebar_menu_truncate = 500 用于解决菜单不全的问题 (27810f1)