diff options
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/summary.html | 2 | ||||
-rw-r--r-- | layouts/book/single.html | 59 | ||||
-rw-r--r-- | layouts/book/summary.html | 36 |
3 files changed, 58 insertions, 39 deletions
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 48c7b97..1f203a1 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html | |||
@@ -13,5 +13,5 @@ | |||
13 | <span>{{ .ReadingTime }} min read</span> | 13 | <span>{{ .ReadingTime }} min read</span> |
14 | </p> | 14 | </p> |
15 | </hgroup> | 15 | </hgroup> |
16 | <div>{{ .Summary | markdownify }}</div> | 16 | <div>{{ .Summary }}</div> |
17 | </section> | 17 | </section> |
diff --git a/layouts/book/single.html b/layouts/book/single.html index 9179523..f025d92 100644 --- a/layouts/book/single.html +++ b/layouts/book/single.html | |||
@@ -1,9 +1,7 @@ | |||
1 | {{ define "main" }} | 1 | {{ define "main" }} |
2 | <hgroup> | 2 | <div class="flex row gap-1"> |
3 | <h1>{{ .Title }}</h1> | ||
4 | <h6>{{ .Date | time.Format ":date_full" }}</h6> | ||
5 | </hgroup> | ||
6 | {{ if isset .Params "image" }} | 3 | {{ if isset .Params "image" }} |
4 | <figure> | ||
7 | {{ with resources.GetRemote .Params.image }} | 5 | {{ with resources.GetRemote .Params.image }} |
8 | {{ with .Err }} | 6 | {{ with .Err }} |
9 | {{ errorf "%s" . }} | 7 | {{ errorf "%s" . }} |
@@ -20,28 +18,39 @@ | |||
20 | {{ else }} | 18 | {{ else }} |
21 | {{ errorf "unable to get remote resource %q" .Params.image }} | 19 | {{ errorf "unable to get remote resource %q" .Params.image }} |
22 | {{ end }} | 20 | {{ end }} |
21 | <figcaption> | ||
22 | </figcaption> | ||
23 | </figure> | ||
23 | {{ end }} | 24 | {{ end }} |
24 | <div class="flex row gap-1"> | 25 | <div class="book-notes"> |
25 | <strong>Rating:</strong> | 26 | <hgroup> |
26 | {{ if isset .Params "rating" }} | 27 | <h1>{{ .Title }}</h1> |
27 | {{ $rating := .Params.rating }} | 28 | {{ with .Params.last_read }} |
28 | {{ range (seq $rating) }} | 29 | {{ $last := index (.) 0 }} |
29 | ⭐ | 30 | {{/* if last_read is an array get the first item */}} |
30 | {{ end }} | 31 | <h6>Finished on: {{ $last | time.Format ":date_full" }}</h6> |
31 | {{ $diff := sub 5 $rating }} | 32 | {{ end }} |
32 | {{ range (seq $diff) }} | 33 | <h6>Rating: |
33 | ☆ | 34 | {{ if isset .Params "rating" }} |
34 | {{ end }} | 35 | {{ $rating := .Params.rating }} |
35 | {{ else }} | 36 | {{ range (seq $rating) }} |
36 | <p>N/A</p> | 37 | ⭐ |
37 | {{ end }} | 38 | {{ end }} |
38 | </div> | 39 | {{ $diff := sub 5 $rating }} |
39 | {{ if isset .Params "amazon" }} | 40 | {{ range (seq $diff) }} |
40 | <p> | 41 | ☆ |
41 | <a href="{{ .Params.amazon }}" target="_blank">amazon</a> | 42 | {{ end }} |
42 | </p> | 43 | {{ else }} |
43 | {{ end }} | 44 | N/A |
44 | <div> | 45 | {{ end }} |
46 | </h6> | ||
47 | {{ if isset .Params "amazon" }} | ||
48 | <h6>Links: | ||
49 | <a href="{{ .Params.amazon }}" target="_blank">Amazon</a> | ||
50 | </h6> | ||
51 | {{ end }} | ||
52 | </hgroup> | ||
45 | {{- .Content -}} | 53 | {{- .Content -}} |
46 | </div> | 54 | </div> |
55 | </div> | ||
47 | {{ end }} \ No newline at end of file | 56 | {{ end }} \ No newline at end of file |
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> |