aboutsummaryrefslogtreecommitdiff
path: root/layouts/book/single.html
blob: 0bbd265124ebfdfafc14a7be642fccf60b7eba28 (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
{{ define "main" }}
    <article>
        <h1>{{ .Title }}</h1>
        <h4>{{ .Params.author }}</h4>
        <h6>{{ .Date | time.Format ":date_full" }}</h6>
        {{ if isset .Params "image" }}
        {{ with resources.GetRemote .Params.image }}
            {{ with .Err }}
                {{ errorf "%s" . }}
            {{ else }}
            <img
                src="{{ .RelPermalink }}"
                width="{{ .Width }}"
                height="{{ .Height }}"
                alt="Book cover of the book {{ .Title }}"
            />
            {{ end }}
        {{ else }}
            {{ errorf "unable to get remote resource %q" .Params.image }}
        {{ end }}
        {{ end }}
        {{ if isset .Params "amazon" }}
        <p>
            <a href="{{ .Params.amazon }}" target="_blank">amazon</a>
        </p>
        {{ end }}
        <div>
            <p>Rating: </p>
            {{ if isset .Params "rating" }}
            {{ $rating := .Params.rating }}
            {{ range $i, $num := (seq $rating) }}
            ⭐
            {{ end }}
            {{ else }}
                <p>N/A</p>
            {{ end }}
        </div>
    </article>
{{ end }}