diff options
author | Zach Berwaldt <17715430+zberwaldt@users.noreply.github.com> | 2023-10-20 22:58:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 22:58:33 -0400 |
commit | c516745d0dc2c6a51777ef00ef116c1b26e95ec7 (patch) | |
tree | adcce31c689d3e63ab3ea8bd36f9ac384eca4cad /layouts/book/list.html | |
parent | b34e09f8fe1011963934dbf40dc92f0b258592ca (diff) | |
parent | 6bfd84ae2c7aad006c3bc84cdce9aebf894cbe62 (diff) |
Develop
Diffstat (limited to 'layouts/book/list.html')
-rw-r--r-- | layouts/book/list.html | 31 |
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 | ||