mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Add ReadDir function to list local files.
Includes documentation.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
72ecd0cdc7
commit
81e69c416d
16
docs/layouts/shortcodes/fileindex.html
Normal file
16
docs/layouts/shortcodes/fileindex.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<table style="width=100%">
|
||||
<th>Size in bytes</th>
|
||||
<th>Name</th>
|
||||
{{$dir := .Get "dir"}}
|
||||
{{ $url := .Get "baseurl" }}
|
||||
|
||||
{{ $files := ReadDir $dir }}
|
||||
{{ range $files }}
|
||||
<tr>
|
||||
<td>{{.Size}}</td>
|
||||
<td>
|
||||
<a href="{{$url}}{{.Name | urlize }}"> {{.Name}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
Reference in New Issue
Block a user