diff options
| author | Eltrac <hi@guhub.cn> | 2025-08-18 10:20:08 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-08-18 10:20:08 +0800 |
| commit | 70bbb02bf56046c8c859783edd9f716cce5944ed (patch) | |
| tree | 04a17835f8073448ef25254fc852629c920a7975 /layouts/library | |
| parent | e0dc97d1a445a4f8c7a881262702d9b7bae338a6 (diff) | |
fix: hide last two books in small screen to create balance
Diffstat (limited to 'layouts/library')
| -rw-r--r-- | layouts/library/section.html | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/layouts/library/section.html b/layouts/library/section.html index 1cb8874a..9526c985 100644 --- a/layouts/library/section.html +++ b/layouts/library/section.html @@ -4,11 +4,14 @@ <div> <h2>{{ now.Year }} 年读的书</h2> <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4"> - {{ range first 18 (where .Site.RegularPages "Section" "library") }} - {{ if eq .Date.Year now.Year }} - {{ partial "items/book" . }} + {{ $books := first 18 (where .Site.RegularPages "Section" "library") }} + {{ range $i, $book := $books }} + {{ if eq .Date.Year now.Year }} + <div class="{{ if gt $i 15 }}hidden md:block{{ end }}"> + {{ partial "items/book" $book }} + </div> + {{ end }} {{ end }} - {{ end }} </div> {{ $years := slice }} |
