aboutsummaryrefslogtreecommitdiff
path: root/layouts/book/single.html
blob: baedf32f523fd88611ab56b1101bda4b28138328 (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
{{ define "main" }}
    <hgroup>
        <h1>{{ .Title }}</h1>
        <h6>{{ .Date | time.Format ":date_full" }}</h6>
    </hgroup>
    {{ if isset .Params "image" }}
    {{ with resources.GetRemote .Params.image }}
        {{ with .Err }}
            {{ errorf "%s" . }}
        {{ else }}
            {{ $image := . }}
            {{ $image := $image.Resize "250x" }}
            <img
                src="{{ $image.RelPermalink }}"
                width="{{ $image.Width }}"
                height="{{ $image.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>
{{ end }}