diff options
Diffstat (limited to 'layouts/book/summary.html')
-rw-r--r-- | layouts/book/summary.html | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/layouts/book/summary.html b/layouts/book/summary.html index 56f2ea7..69419e0 100644 --- a/layouts/book/summary.html +++ b/layouts/book/summary.html | |||
@@ -1,19 +1,26 @@ | |||
1 | <section class="flex row gap-1"> | 1 | <section class="flex row gap-1"> |
2 | {{ with resources.GetRemote .Params.image }} | 2 | {{ if isset .Params "image" }} |
3 | {{ with .Err }} | 3 | {{ with resources.GetRemote .Params.image }} |
4 | {{ errorf "%s" . }} | 4 | {{ with .Err }} |
5 | {{ errorf "%s" . }} | ||
6 | {{ else }} | ||
7 | {{ $image := . }} | ||
8 | {{ $image := $image.Resize "150x" }} | ||
9 | <img | ||
10 | src="{{ $image.RelPermalink }}" | ||
11 | width="{{ $image.Width }}" | ||
12 | height="{{ $image.Height }}" | ||
13 | alt="Book cover of the book {{ .Title }}" | ||
14 | style="border: solid 1px #8d8d8d;" | ||
15 | /> | ||
16 | {{ end }} | ||
5 | {{ else }} | 17 | {{ else }} |
6 | {{ $image := . }} | 18 | {{ errorf "unable to get remote resource %q" .Params.image }} |
7 | {{ $image := $image.Resize "150x" }} | ||
8 | <img | ||
9 | src="{{ $image.RelPermalink }}" | ||
10 | width="{{ $image.Width }}" | ||
11 | height="{{ $image.Height }}" | ||
12 | alt="Book cover of the book {{ .Title }}" | ||
13 | /> | ||
14 | {{ end }} | 19 | {{ end }} |
15 | {{ else }} | 20 | {{ else }} |
16 | {{ errorf "unable to get remote resource %q" .Params.image }} | 21 | <div |
22 | style="background: grey; border: solid 1px #8d8d8d; width: 150px; height: 225px;" | ||
23 | ></div> | ||
17 | {{ end }} | 24 | {{ end }} |
18 | <hgroup> | 25 | <hgroup> |
19 | <h3 class="f3 near-black"> | 26 | <h3 class="f3 near-black"> |
@@ -27,7 +34,10 @@ | |||
27 | </h3> | 34 | </h3> |
28 | <p>Rating: {{ .Params.rating }} / 5</p> | 35 | <p>Rating: {{ .Params.rating }} / 5</p> |
29 | {{ with .Params.last_read }} | 36 | {{ with .Params.last_read }} |
30 | <p>Last Read: {{ . | time.Format ":date_full" }}</p> | 37 | {{ $last := index (.) 0 }} |
38 | {{/* if last_read is an array get the first item */}} | ||
39 | |||
40 | <p>Last Read: {{ $last | time.Format ":date_full" }}</p> | ||
31 | {{ end }} | 41 | {{ end }} |
32 | </hgroup> | 42 | </hgroup> |
33 | </section> | 43 | </section> |