blob: 3910bcadfb81de3d4d42c056b4778174677b7324 (
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" }}
{{ partial "header.html" . }}
<article class="pagefind-exclude">
<div>
<h2>{{ now.Year }} 年读的书</h2>
<div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
{{ range where .Site.RegularPages "Section" "library" }}
{{ if eq .Date.Year now.Year }}
{{ partial "items/book" . }}
{{ end }}
{{ end }}
</div>
{{ $years := slice }}
{{ range where .Site.RegularPages "Section" "library" }}
{{ $year := string .Date.Year }}
{{ if not (in $years $year) }}
{{ $years = $years | append $year }}
{{ end }}
{{ end }}
<div class="markdown-body">
<p>往年书单:
{{ $currentYear := printf "%d" now.Year }}
{{ range $years }}
{{ if ne . $currentYear }}<a href="{{ printf "/library/%s/" . }}">{{ . }} 年</a>{{ end }}
{{ end }}
</p>
</div>
<h2>推荐好书</h2>
<div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4">
{{ range where (where .Site.RegularPages "Section" "library") ".Params.rating" "==" 5 }}
{{ partial "items/book" . }}
{{ end }}
</div>
</div>
</article>
{{ partial "footer.html" . }}
{{ end }}
|