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 --- assets/Darkmode.svg | 12 ++++++++++++ assets/Lightmode.svg | 39 ++++++++++++++++++++++++++++++++++++++ assets/css/main.css | 6 ++++++ 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 ++++++++++++------ 8 files changed, 120 insertions(+), 8 deletions(-) create mode 100755 assets/Darkmode.svg create mode 100755 assets/Lightmode.svg create mode 100644 layouts/book/list.html diff --git a/assets/Darkmode.svg b/assets/Darkmode.svg new file mode 100755 index 0000000..e6d13b6 --- /dev/null +++ b/assets/Darkmode.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/Lightmode.svg b/assets/Lightmode.svg new file mode 100755 index 0000000..f4c4319 --- /dev/null +++ b/assets/Lightmode.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/css/main.css b/assets/css/main.css index a7d2bf8..af25dae 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -110,6 +110,12 @@ footer { font-weight: 600; } +.icon span { + display: inline-block; + width: fit-content; + height: fit-content; +} + .icon svg { width: 1em; height: 1em; 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