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