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/_default/list.html | 2 +- layouts/_default/summary.html | 3 +++ layouts/book/list.html | 33 +++++++++++++++++++++++++++++++++ layouts/book/single.html | 15 ++++++++++++++- layouts/partials/site-actions.html | 18 ++++++++++++------ 5 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 layouts/book/list.html (limited to 'layouts') diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 38ef025..c265f91 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+

{{ .Title }}

{{ if .Content }}

{{ .Content }}

diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 0753995..5e4ac4b 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -4,6 +4,9 @@ {{ .Title }} + {{ if isset .Params "rating" }} + {{ .Params.rating }} + {{ end }}

{{ .Date | time.Format ":date_full" }} 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" }}

diff --git a/layouts/partials/site-actions.html b/layouts/partials/site-actions.html index b9afa66..ac9013a 100644 --- a/layouts/partials/site-actions.html +++ b/layouts/partials/site-actions.html @@ -1,12 +1,18 @@

- +
\ No newline at end of file -- cgit v1.1