From 2526b98323d778ccc2b25a7d562d8289381f600b Mon Sep 17 00:00:00 2001 From: wait4x Date: Tue, 3 Nov 2026 02:41:48 +0000 Subject: [PATCH 1/5] =?UTF-8?q?Update=20=E9=A1=B5=E9=9D=A2=E6=96=87?= =?UTF-8?q?=E6=A1=88=20=E2=80=9Chome=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/site/home.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/content/site/home.yaml b/content/site/home.yaml index 2cfd7ce..2b723fd 100644 --- a/content/site/home.yaml +++ b/content/site/home.yaml @@ -1,6 +1,6 @@ tagline: - zh: 写作者 · 读者 · 快门按压者,拥抱开源。 - en: Writer · Reader · Shutter-presser — embracing open source. + zh: 拥抱开源,热爱开源 + en: Embracing open source, loving open source. latestPhotos: 4 perTrackLimit: 6 sections: @@ -13,9 +13,6 @@ socials: - label: GitHub url: https://github.com/wait4xx icon: github - - label: RSS - url: /rss.xml - icon: rss - label: 邮件 url: mailto:X@alumni.nudt.edu.cn icon: email From b8c5e1c86e841ef29d329c00bc89a6b5e4c9f465 Mon Sep 17 00:00:00 2001 From: wait4xx Date: Tue, 3 Nov 2026 11:41:32 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat(books):=20=E4=B9=A6=E6=9E=B6=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E9=A2=84=E8=A7=88=E9=A1=B5=E5=85=88=E8=A1=8C?= =?UTF-8?q?=E4=B8=8A=E7=BA=BF=EF=BC=88=E4=B8=B4=E6=97=B6=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户要「直接查看网页」来选方案,故本页单独先部署;其余改版(字体按需加载、 灯箱关闭与 caption 排版、评论误报、开源页动效)仍在验证分支,选定方案后一并 合并并删掉本临时路由。 Spec: none (预览页需先上线供用户选择,其余改动仍在 spec/2026-11-02_blog-5i-fonts-polish 验证) Co-authored-by: GLM-5.3 --- src/pages/books-preview.astro | 357 ++++++++++++++++++++++++++++++++++ 1 file changed, 357 insertions(+) create mode 100644 src/pages/books-preview.astro diff --git a/src/pages/books-preview.astro b/src/pages/books-preview.astro new file mode 100644 index 0000000..10ba73f --- /dev/null +++ b/src/pages/books-preview.astro @@ -0,0 +1,357 @@ +--- +/** + * 书架改版方案预览(Phase 5i T7):一页并陈三个方案,供用户直接点选。 + * + * 为什么做成预览页而不是直接改 /books:书架是纯审美决策,改错要回滚一轮; + * 一页三案 + 页顶锚点,用户在手机或桌面点开就能比,选定后我再把选中的方案 + * 落到 BooksPage.astro,然后删掉本预览路由(含 sitemap 排除与 noindex)。 + * + * 三方案共同的数据契约与 BooksPage 一致:posts 里 category=reading 的条目, + * 封面走 Astro image()(cover 缺省时用 mood 色脊兜底),description 缺省取正文首段。 + */ +import { getCollection } from 'astro:content'; +import { Image } from 'astro:assets'; +import BaseLayout from '../layouts/BaseLayout.astro'; +import { sortPosts } from '../lib/post-order'; + +const books = sortPosts( + await getCollection( + 'posts', + ({ data }) => !data.draft && data.category === 'reading' && !data.tags.includes('hidden'), + ), +); + +/** description 缺省回退正文首段(去 markdown 记号、截 60 字),与 BooksPage 同契约 */ +const firstPara = (body: string | undefined): string => { + const line = + (body ?? '') + .split(/\n\s*\n/) + .map((l) => l.trim()) + .find((l) => l && !l.startsWith('#') && !l.startsWith('---')) ?? ''; + return line.replace(/[*_>`[\]]/g, '').slice(0, 60); +}; + +const items = books.map((b) => ({ + id: b.id, + title: b.data.title, + author: b.data.bookAuthor ?? '', + desc: b.data.description ?? firstPara(b.body), + cover: b.data.cover, + mood: b.data.mood ?? 'var(--ink-4)', + year: b.data.pubDate.getFullYear(), + href: `/archives/${b.id}/`, +})); +const years = [...new Set(items.map((i) => i.year))].sort((a, b) => b - a); +const withCover = items.filter((i) => i.cover).length; +--- + + + +

书架改版:三个方案

+

+ 共 {items.length} 本书,其中 {withCover} 本有封面图。三个方案用同一份数据渲染, + 看完告诉我选哪个(回「A」「B」或「C」即可,也可以说「B 但标题字大一点」这类微调)。 +

+ + + + +
+
+ A +

竖排色脊墙

+

像真书架:书脊竖排、颜色即情绪。优点最像"书架";代价无封面的书看不出内容,标题长会挤。

+
+ + {years.map((year) => ( +
+

{year} · {items.filter((i) => i.year === year).length} 本

+ +
+ ))} +
+ + +
+
+ B +

封面网格

+

以封面为主角,悬停浮起并显出简介。优点视觉最抓人、信息最全;兜底无封面的书用色脊占位,不出现空洞卡。

+
+ + {years.map((year) => ( +
+

{year} · {items.filter((i) => i.year === year).length} 本

+