mirror of
https://github.com/yihui/hugo-xmin.git
synced 2024-11-23 08:59:19 +02:00
Add one shortcode to display directory files
This commit is contained in:
parent
bb54be4a4c
commit
3c3867f83a
|
@ -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 New Issue