blogamore/layouts/shortcodes/download.html

13 lines
400 B
HTML
Raw Normal View History

{{ $dataName := .Get "data" }}
{{ $baseDir := path.Dir .Page.File }}
<ul>
{{ range (index .Site.Data (split $dataName "/")) }}
{{ $filename := (path.Join $baseDir .filename) }}
{{ $file := os.Stat $filename }}
{{ if $file }}
<li><a href="{{ $filename | absURL }}">{{ .title }} ({{ div (div $file.Size 1024) 1024 }} MB)</a><br/>{{ .comment }}</li>
{{ end }}
{{ end }}
</ul>