diff options
| -rw-r--r-- | assets/css/components/_library.scss | 2 | ||||
| -rw-r--r-- | layouts/library/section.html | 21 |
2 files changed, 15 insertions, 8 deletions
diff --git a/assets/css/components/_library.scss b/assets/css/components/_library.scss index 5179076f..40135ce8 100644 --- a/assets/css/components/_library.scss +++ b/assets/css/components/_library.scss @@ -1,5 +1,5 @@ #library { - #library-content { + .book-group { --gap: 1rem; display: flex; align-items: center; diff --git a/layouts/library/section.html b/layouts/library/section.html index bc55b500..7d824879 100644 --- a/layouts/library/section.html +++ b/layouts/library/section.html @@ -2,13 +2,20 @@ {{ partial "header.html" . }} <article id="library"> <div id="library-content"> - {{- range .Pages }} - <div class="book{{ if eq .Params.rating 1 }} badbook{{ end }}{{ if eq .Params.rating 5 }} goodbook{{ end }}"> - <a href="{{ .Permalink }}" class="book-cover" style="view-transition-name: book-{{ .Title }}"> - <img src="{{ .Params.cover }}" /> - </a> - </div> - {{- end }} + {{ range .Pages.GroupByDate "2006" }} <!-- 按年份分组 --> + <h2>{{ .Key }}</h2> <!-- 显示年份 --> + <div class="book-group"> + {{ range .Pages }} + <div class="book{{ if eq .Params.rating 1 }} badbook{{ end }}{{ if eq .Params.rating 5 }} goodbook{{ end }}"> + <a href="{{ .Permalink }}" class="book-cover" style="view-transition-name: book-{{ .Title }}"> + <img src="{{ .Params.cover }}!thumbnail" + class="lazy" data-src="{{ .Params.cover }}" /> + </a> + </div> + {{ end }} + </div> + {{ end }} + <p>关于 2024 年的更多书目,请阅读《<a href="/posts/in-libris-libertas/#%E4%BB%8A%E5%B9%B4%E7%9A%84%E4%B9%A6%E5%8D%95">IN LIBRIS LIBERTAS</a>》</p> </div> </article> {{ end }} |
