From 6bfd84ae2c7aad006c3bc84cdce9aebf894cbe62 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 20 Oct 2023 22:49:31 -0400 Subject: add summary for books --- layouts/book/list.html | 2 +- layouts/book/single.html | 14 ++++++++------ layouts/book/summary.html | 29 +++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 layouts/book/summary.html (limited to 'layouts/book') diff --git a/layouts/book/list.html b/layouts/book/list.html index d1d1263..25976dd 100644 --- a/layouts/book/list.html +++ b/layouts/book/list.html @@ -5,7 +5,7 @@ {{ end }}
{{ if .IsSection }} - {{ range sort (.Paginator 3).Pages "Date" "desc" }} + {{ range sort .Pages "Date" "desc" }} {{ if ne .Layout "list" }}
{{ .Render "summary" }}
{{ end }} diff --git a/layouts/book/single.html b/layouts/book/single.html index 66456e1..baedf32 100644 --- a/layouts/book/single.html +++ b/layouts/book/single.html @@ -8,12 +8,14 @@ {{ with .Err }} {{ errorf "%s" . }} {{ else }} - Book cover of the book {{ .Title }} + {{ $image := . }} + {{ $image := $image.Resize "250x" }} + Book cover of the book {{ .Title }} {{ end }} {{ else }} {{ errorf "unable to get remote resource %q" .Params.image }} diff --git a/layouts/book/summary.html b/layouts/book/summary.html new file mode 100644 index 0000000..900fb87 --- /dev/null +++ b/layouts/book/summary.html @@ -0,0 +1,29 @@ +
+ {{ with resources.GetRemote .Params.image }} + {{ with .Err }} + {{ errorf "%s" . }} + {{ else }} + {{ $image := . }} + {{ $image := $image.Resize "150x" }} + Book cover of the book {{ .Title }} + {{ end }} + {{ else }} + {{ errorf "unable to get remote resource %q" .Params.image }} + {{ end }} +
+

+ + {{ .Title }} + +

+

Rating: {{ .Params.rating }} / 5

+ {{ with .Params.last_read }} +

Last Read: {{ . | time.Format ":date_full" }}

+ {{ end }} +
+
-- cgit v1.1