Initial Commit
[ancientarts.git] / hugo / themes / ancientarts / layouts / _default / list.html
1 {{- define "main" -}}
2 {{- .Content }}
3 {{- $paginator := .Paginate .Pages.ByPublishDate.Reverse 12 }} <!-- 12 -->
4 {{- $.Scratch.Set "cardskip" 0 }}
5 {{- if eq $paginator.PageNumber 1 }}
6 {{- $.Scratch.Set "cardskip" 6 }}
7 {{- range first ($.Scratch.Get "cardskip") $paginator.Pages }}
8 {{- $ph := cond (or (not .Params.header) (not (fileExists (printf "static/%s" .Params.header)))) (cond (or (not .Parent.Params.header) (not (fileExists (printf "static/%s" .Parent.Params.header)))) "/img/speedy.png" .Parent.Params.header) .Params.header }}
9 <section id="{{ .File.Path }}">
10 <a class="speedy-header" href="{{ .URL }}">
11 <h1>
12 <img src="{{ $ph }}">
13 {{ .Title }}
14 <div style="font-weight: normal; font-size: 0.8rem;">{{ dateFormat "January 2 2006 15:04 MST" .PublishDate }}</div>
15 </h1>
16 </a>
17 {{ .Content | safeHTML | truncate 1024 }}
18 {{- if .Truncated }}
19 <div align="right"><a href="{{ .URL }}">Read More...</a></div>
20 {{- end }}
21 </section>
22 {{- end }}
23 {{- end }}
24 {{- $cardskip := $.Scratch.Get "cardskip" }}
25 {{- if gt (len $paginator.Pages) $cardskip }}
26 <div class="speedy-cards">
27 {{- if gt $cardskip 1 }}
28 {{- range after $cardskip $paginator.Pages }}
29 {{- partial "speedycard.html" . -}}
30 {{- end }}
31 {{- else }}
32 {{- range $paginator.Pages }}
33 {{- partial "speedycard.html" . -}}
34 {{- end }}
35 {{- end }}
36 </div>
37 {{ partial "pagination.html" . -}}
38 {{- end }}
39 {{- end -}}