46ef1e11cc21f495c841a6163ab2599c4bd1a315
[kengrimes.com/theme.git] / layouts / _default / list.html
1 {{- define "main" -}}
2 {{- .Content }}
3 {{- $paginator := .Paginate .Pages.ByPublishDate.Reverse 6 }} <!-- 12 -->
4 {{- $.Scratch.Set "cardskip" 0 }}
5 {{- if eq $paginator.PageNumber 1 }}
6 {{- $.Scratch.Set "cardskip" 4 }}
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 <article>
10 <a class="speedy-header" href="{{ absURL .URL }}">
11 <div class="speedy-img"><div style="background-image: url({{ relURL $ph }});"></div></div>
12 <h1>
13 {{ .Title }}
14 <div style="font-weight: normal; font-size: 0.8rem;">{{ dateFormat "January 2 2006 15:04 MST" .PublishDate }}</div>
15 </h1>
16 <div class="speedy-img" style="height: 0px"></div>
17 </a>
18 {{ .Content | safeHTML | truncate 1024 }}
19 {{- if .Truncated }}
20 <div align="right"><a href="{{ absURL .URL }}">Read More...</a></div>
21 {{- end }}
22 </article>
23 {{- end }}
24 {{- end }}
25 {{- $cardskip := $.Scratch.Get "cardskip" }}
26 {{- if gt (len $paginator.Pages) $cardskip }}
27 <div class="speedy-cards">
28 {{- if gt $cardskip 1 }}
29 {{- range after $cardskip $paginator.Pages }}
30 {{- partial "speedycard.html" . -}}
31 {{- end }}
32 {{- else }}
33 {{- range $paginator.Pages }}
34 {{- partial "speedycard.html" . -}}
35 {{- end }}
36 {{- end }}
37 </div>
38 {{ partial "pagination.html" . -}}
39 {{- end }}
40 {{- end -}}