colorized light, text formatting
[kengrimes.com/theme.git] / layouts / _default / list.html
index b14ce45..7a0b267 100644 (file)
@@ -1,20 +1,39 @@
 {{- define "main" -}}
-{{ $paginator := .Paginate (where .Data.Pages.ByDate "Section" .Section) 5 }}
-{{- if (gt (len (findRE "<h1" .Content)) 0) -}}
-{{ replaceRE "(<h1.*</h1>)" "</article>\n$1\n<article>" .Content | strings.TrimLeft "\n " | strings.TrimPrefix "</article>" | replaceRE "\n" "\n      " | safeHTML }}</article>
-{{- else -}}
-{{ .Content }}
-{{- end -}}
-{{ range $paginator.Pages }}
-      <h1>{{.Title}}</h1>
-      <article>
-        <p>
-          {{ .Summary | replaceRE "\n" "\n          " | safeHTML }}
-        </p>
-{{- if .Truncated }}
-        <div align="right"><a href="{{ .RelPermalink }}">Continue...</a>&nbsp;</div>
+{{- .Content }}
+{{- $paginator := .Paginate .Pages.ByPublishDate.Reverse 12 }} <!-- 12 -->
+{{- $.Scratch.Set "cardskip" 0 }}
+{{- if eq $paginator.PageNumber 1 }}
+{{- $.Scratch.Set "cardskip" 6 }}
+{{- range first ($.Scratch.Get "cardskip") $paginator.Pages }}
+{{- $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 }}
+      <section>
+      <a class="speedy-header" href="{{ absURL .URL }}">
+        <h1>
+        <img src="{{ absURL $ph }}">
+         {{ .Title }}
+         <div style="font-weight: normal; font-size: 0.8rem;">{{ dateFormat "January 2 2006 15:04 MST" .PublishDate }}</div>
+      </h1>
+      </a>
+        {{ .Content | safeHTML | truncate 1024 }}
+        {{- if .Truncated }}
+        <div align="right"><a href="{{ absURL .URL }}">Read More...</a></div>
+        {{- end }}
+      </section>
+{{- end }}
 {{- end }}
-      </article>
+{{-  $cardskip := $.Scratch.Get "cardskip" }}
+{{- if gt (len $paginator.Pages) $cardskip }}
+      <div class="speedy-cards">
+        {{- if gt $cardskip 1 }}
+        {{- range after $cardskip $paginator.Pages }}
+        {{- partial "speedycard.html" . -}}
+        {{- end }}
+        {{- else }}
+        {{- range $paginator.Pages }}
+        {{- partial "speedycard.html" . -}}
+        {{- end }}
+        {{- end }}
+      </div>
+{{ partial "pagination.html" . -}}
 {{- end }}
-{{ template "_internal/pagination.html" . -}}
 {{- end -}}