aboutsummaryrefslogtreecommitdiff
path: root/layouts/book/list.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/book/list.html')
-rw-r--r--layouts/book/list.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/layouts/book/list.html b/layouts/book/list.html
new file mode 100644
index 0000000..628d8b8
--- /dev/null
+++ b/layouts/book/list.html
@@ -0,0 +1,33 @@
1{{ define "main" }}
2 <article>
3 <h1>{{ .Title }}</h1>
4 {{ if .Content }}
5 <p>{{- .Content -}}</p>
6 {{ end }}
7 <section>
8 {{ if .IsSection }}
9 {{ range sort (.Paginator 3).Pages "Date" "desc" }}
10 {{ if ne .Layout "list" }}
11 <div>{{ .Render "summary" }}</div>
12 {{ end }}
13 {{ end }}
14 {{ else }}
15 {{ $metric := .Params.sortby }}
16 {{ $direction := "asc" }}
17 {{ if eq .Params.sortby "rating" }}
18 {{ $direction = "desc" }}
19 {{ end }}
20 {{ $pages := (where .Site.RegularPages "Type" "book") }}
21 {{ $pages = (where $pages "Layout" "!=" "list")}}
22 {{ if eq $direction "desc" }}
23 {{ $pages = (sort ($pages.ByParam $metric).Reverse) }}
24 {{ else }}
25 {{ $pages = (sort ($pages.ByParam $metric)) }}
26 {{ end }}
27 {{ range $pages }}
28 <div>{{ .Render "summary" }}</div>
29 {{ end }}
30 {{ end }}
31 </section>
32 </article>
33{{ end }} \ No newline at end of file