summaryrefslogtreecommitdiff
path: root/layouts/library/page.html
blob: 310b19a71f045a5c1b4777f83de0eb0a025a8c44 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{{ define "main" }}
    <article>
        <header class="flex flex-col items-center gap-2">
            <div class="relative border-3 border-solid border-white shadow-lg w-[10rem] md:w-[15rem]"
                style="view-transition-name: book-{{ .File.UniqueID }}">
                <img
                    class="lazy block w-full h-auto" loading="lazy"
                    data-pagefind-meta="image[src]"
                    src="{{ .Params.cover }}"
                />
                {{ partial "components/logo"
                (dict
                    "link" "library"
                    "ctx" .
                    "class" "round-sticker absolute w-8 h-8 md:w-20 md:h-20 top-8 -right-8 md:-right-12"
                    "imageClass" "w-full") }}
            </div>
            <h1 class="xerox" data-pagefind-meta="title">{{ .Title }}</h1>
            {{- $rating := .Params.rating -}}
            {{- $fullStars := math.Floor $rating -}}
            <p class="m-0">
                {{ with .Params.authors }}{{ delimit . ", " }}{{ end }}
            </p>
            <p class="m-0">
                {{- range seq $fullStars }}
                <span class="star">⭐</span>
                {{- end -}}
            </p>
        </header>

        <div class="markdown-body leading-loose text-size-lg md:text-size-xl">
            {{ partial "posts/toc" . }}
            <div>{{ .Content }}</div>
            {{ partial "posts/endnotes" . }}
        </div>

        <div class="text-size-base text-secondary md:flex md:justify-between">
            <p>于 {{ partial "components/date" . }} 读完</p>
            <p>{{ partial "components/tags" . }}</p>
        </div>

        {{ partial "components/backlinks" (dict "filename" .File.BaseFileName "type" "library" "context" .) }}
        {{ partial "posts/action-menu.html" . }}
        {{ partial "components/back-to-top.html" . }}



        {{ with .Params.authors }}
          {{ $author := index . 0 }}
          {{ $term := index $.Site.Taxonomies.authors $author }}
          {{ if and $term (gt (len $term.Pages) 1) }}
            <h2>我读过的 {{ $author }} 的其它书籍</h2>
            <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
              {{ range $term.Pages }}
                {{ if ne .File.UniqueID $.File.UniqueID }}
                  <div data-tooltip="{{ .Title }}">
                    {{ partial "items/book" (dict "ctx" .) }}
                  </div>
                {{ end }}
              {{ end }}
            </div>
          {{ end }}
        {{ end }}
    </article>
{{ end }}