feat(books): 书封接口——schema cover 字段+书架卡封面渲染

posts schema 加 cover?: image(image() 走 Astro 优化管线,仅阅读
轨消费);BooksPage 有封面渲染 96/192 两档 Image、无封面优雅回
退现有色脊卡设计(零破坏);目录 content/posts/assets/books/ 就位;
docs/写作指南.md 补用法节(路径/frontmatter 示例/尺寸建议)。

验证: pnpm astro build;E2E 34/34;现 5 本书全部回退色脊卡渲染
(封面貌 0,待用户加图)

Spec: none (书封接口预留,用户自行加图)

Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-11-02 09:12:34 +08:00
1 parent 2e33a7cd2e
commit 9702c9faf4
3 files changed
+46 -2

No files matched your search

+21
View File
@@ -69,3 +69,24 @@ public/media/my-post/clip.mp4 ← 文件放这里
- push main → webhook 自动构建发布(约 10 秒)
- 新文章要英文版:跑 `python3 scripts/translate/translate_posts.py`(幂等,代码块不会被翻译破坏的风险见其 README 注释;锁定润色用 frontmatter `locked: true`)
## 书封图(/books 书架)
阅读轨文章可选加书封:
1. 图片放 `content/posts/assets/books/<slug>.jpg`(建议宽 480px、高宽比约 2:3)
2. 对应文章 frontmatter 加一行:`cover: ./assets/books/<slug>.jpg`
3. 构建自动优化出 96/192 两档;**没有 cover 的文章优雅回退现有色脊卡设计**,无需改任何代码
示例 frontmatter:
```yaml
---
title: "面纱"
pubDate: 2024-06-01
category: reading
bookAuthor: "毛姆"
mood: "#8a6f4a"
cover: ./assets/books/mian-sha.jpg
---
```