mirror of
https://github.com/yihui/hugo-xmin.git
synced 2024-12-27 23:43:31 +02:00
Add one shortcode to display directory files
This commit is contained in:
parent
bb54be4a4c
commit
3c3867f83a
1 changed files with 13 additions and 0 deletions
13
layouts/shortcodes/directoryindex.html
Normal file
13
layouts/shortcodes/directoryindex.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{- $pathURL := .Get "pathURL" -}}
|
||||
{{- $path := .Get "path" -}}
|
||||
{{- $files := readDir $path -}}
|
||||
<table>
|
||||
<th>文件大小(字节)</th>
|
||||
<th>文件名称</th>
|
||||
{{- range $files }}
|
||||
<tr>
|
||||
<td>{{ .Size }}</td>
|
||||
<td><a href="{{ $pathURL }}{{ .Name | relURL }}" target="_blank"> {{ .Name }}</a></td>
|
||||
</tr>
|
||||
{{- end }}
|
||||
</table>
|
Loading…
Reference in a new issue