aboutsummaryrefslogtreecommitdiff
path: root/layouts/book/summary.html
blob: 69419e06d5fca12bf34f3f7a8d1c539dc04b7d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<section class="flex row gap-1">
  {{ if isset .Params "image" }}
    {{ with resources.GetRemote .Params.image }}
      {{ with .Err }}
          {{ errorf "%s" . }}
      {{ else }}
      {{ $image := . }}
      {{ $image := $image.Resize "150x" }}
      <img
          src="{{ $image.RelPermalink }}"
          width="{{ $image.Width }}"
          height="{{ $image.Height }}"
          alt="Book cover of the book {{ .Title }}"
          style="border: solid 1px #8d8d8d;"
      />
      {{ end }}
    {{ else }}
      {{ errorf "unable to get remote resource %q" .Params.image }}
    {{ end }}
  {{ else }}
    <div
      style="background: grey; border: solid 1px #8d8d8d; width: 150px; height: 225px;"
    ></div>
  {{ end }}
  <hgroup>
    <h3 class="f3 near-black">
      {{ if .Content }}
      <a href="{{ .RelPermalink }}" class="link black dim">
        {{ .Title }}
      </a>
      {{ else }}
      {{ .Title }}
      {{ end }}
    </h3>
    <p>Rating: {{ .Params.rating }} / 5</p>
    {{ with .Params.last_read }}
      {{ $last := index (.) 0 }}
      {{/* if last_read is an array get the first item */}}

    <p>Last Read: {{ $last | time.Format ":date_full" }}</p>
    {{ end }}
  </hgroup>
</section>