summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-07-27 10:20:31 +0800
committerEltrac <hi@guhub.cn>2025-07-27 10:20:31 +0800
commit1f37c92409ecaa38b6d6611908b30fee02938abb (patch)
treedfca3a7bcfb0c7c043183b4b188c205dd8be56c9
parenta49c3370ca3df1de61fa77f111d6a69926293b05 (diff)
feat: less books in library section, display tags in book page
Former-commit-id: efb3baca5a534e40555f379d6d3e6361b8e7cc8b
-rw-r--r--i18n/en.yml2
-rw-r--r--i18n/zh.yml2
-rw-r--r--layouts/library/page.html12
-rw-r--r--layouts/library/section.html13
4 files changed, 18 insertions, 11 deletions
diff --git a/i18n/en.yml b/i18n/en.yml
index 12ea2ed1..8831e018 100644
--- a/i18n/en.yml
+++ b/i18n/en.yml
@@ -25,3 +25,5 @@ termPage:
books: "Books I've read about this topic"
RSS: RSS
statsTooltip: Insights
+library:
+ viewAllThisYear: All Books This Year
diff --git a/i18n/zh.yml b/i18n/zh.yml
index 7d3fd5c5..b5decd54 100644
--- a/i18n/zh.yml
+++ b/i18n/zh.yml
@@ -26,3 +26,5 @@ termPage:
books: '我读过的相关书籍'
RSS: 订阅
statsTooltip: 洞察
+library:
+ viewAllThisYear: 查看今年完整书单
diff --git a/layouts/library/page.html b/layouts/library/page.html
index 57007f04..e824077a 100644
--- a/layouts/library/page.html
+++ b/layouts/library/page.html
@@ -27,14 +27,12 @@
</p>
</header>
<div class="markdown-body">
- <div class="leading-loose">
- {{ .Content }}
- </div>
- <!-- Endnotes -->
+ <div class="leading-loose">{{ .Content }}</div>
{{ partial "posts/endnotes" . }}
- <div class="text-size-base text-secondary">
- <p>于 {{ partial "components/date" . }} 读完</p>
- </div>
+ </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 "posts/comment.html" . }}
</article>
diff --git a/layouts/library/section.html b/layouts/library/section.html
index 3910bcad..1cb8874a 100644
--- a/layouts/library/section.html
+++ b/layouts/library/section.html
@@ -4,7 +4,7 @@
<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" }}
+ {{ range first 18 (where .Site.RegularPages "Section" "library") }}
{{ if eq .Date.Year now.Year }}
{{ partial "items/book" . }}
{{ end }}
@@ -19,11 +19,16 @@
{{ end }}
{{ end }}
- <div class="markdown-body">
- <p>往年书单:
+
+ <div class="flex items-center my-8">
+ <a href="/library/2025" class="small-button">
+ {{ T "library.viewAllThisYear" }}
+ <span class="text-secondary">→</span>
+ </a>
+ <p class="my-0 mx-4">
{{ $currentYear := printf "%d" now.Year }}
{{ range $years }}
- {{ if ne . $currentYear }}<a href="{{ printf "/library/%s/" . }}">{{ . }} 年</a>{{ end }}
+ {{ if ne . $currentYear }}<a class="text-secondary" href="{{ printf "/library/%s/" . }}">{{ . }} 年</a>{{ end }}
{{ end }}
</p>
</div>