From d0e7f43601e90229b95191a1cdc85039e233b622 Mon Sep 17 00:00:00 2001 From: Zach Berwaldt Date: Mon, 9 Oct 2023 21:08:24 -0400 Subject: add icons, refine styles, update layouts --- layouts/book/list.html | 33 +++++++++++++++++++++++++++++++++ layouts/book/single.html | 15 ++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 layouts/book/list.html (limited to 'layouts/book') 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 @@ +{{ define "main" }} +
+

{{ .Title }}

+ {{ if .Content }} +

{{- .Content -}}

+ {{ end }} +
+ {{ if .IsSection }} + {{ range sort (.Paginator 3).Pages "Date" "desc" }} + {{ if ne .Layout "list" }} +
{{ .Render "summary" }}
+ {{ end }} + {{ end }} + {{ else }} + {{ $metric := .Params.sortby }} + {{ $direction := "asc" }} + {{ if eq .Params.sortby "rating" }} + {{ $direction = "desc" }} + {{ end }} + {{ $pages := (where .Site.RegularPages "Type" "book") }} + {{ $pages = (where $pages "Layout" "!=" "list")}} + {{ if eq $direction "desc" }} + {{ $pages = (sort ($pages.ByParam $metric).Reverse) }} + {{ else }} + {{ $pages = (sort ($pages.ByParam $metric)) }} + {{ end }} + {{ range $pages }} +
{{ .Render "summary" }}
+ {{ end }} + {{ end }} +
+
+{{ end }} \ No newline at end of file diff --git a/layouts/book/single.html b/layouts/book/single.html index 3ffb236..0bbd265 100644 --- a/layouts/book/single.html +++ b/layouts/book/single.html @@ -4,7 +4,20 @@

{{ .Params.author }}

{{ .Date | time.Format ":date_full" }}
{{ if isset .Params "image" }} - Book cover of the book {{ .Title }} + {{ with resources.GetRemote .Params.image }} + {{ with .Err }} + {{ errorf "%s" . }} + {{ else }} + Book cover of the book {{ .Title }} + {{ end }} + {{ else }} + {{ errorf "unable to get remote resource %q" .Params.image }} + {{ end }} {{ end }} {{ if isset .Params "amazon" }}

-- cgit v1.1