personal-blog/layouts/shortcodes/pdflist.html

23 lines
573 B
HTML

{{ $path := $.Page.Dir }}
{{ $filePath := printf "content/%s" ($path) }}
{{ $withCaptions := .Get "withCaptions"}}
{{ $gallery := .Get "id" }}
{{ range readDir ($filePath) }}
{{ $display := strings.HasSuffix .Name "pdf" }}
{{ $caption := substr .Name 0 128 }}
{{ if $display}}
<div class="file-list-item">
<a href="{{.Name}}">
<i class="fas fa-file-pdf"></i> {{ $caption}}
</a>
</div>
{{ end }}
{{ end }}
<style type="text/css">
.file-list-item {
word-break: break-all;
}
</style>