书架首页改成「在读」,书籍挪到 /bookshelf/books/
原来 /bookshelf/ 是书籍页,点顶部导航「书架」直接进书籍,
和「先看在读」的预期相反。
- /bookshelf/ -> 在读页(view="reading")
- /bookshelf/books/ -> 书籍页(view="books")
- 顶部导航「书架」保持指向 /bookshelf/,现在落在在读页,不用改导航
- 侧栏「馆藏」:在读 -> /bookshelf/,书籍 -> /bookshelf/books/
- /bookshelf/reading/ 这个临时 URL 撤掉(还没上线,没有外链负担)
因为导航的 isCurrent 用的是 startsWith,在 /bookshelf/books/ 下
顶部「书架」仍然是高亮状态,符合预期。
验证
- /bookshelf/ : title「在读 20 本」、id=reading、20 张卡、20 条进度条、
无书籍区块;侧栏「在读」带 aria-current
- /bookshelf/books/ : title「书籍」、id=books、已读完分组 6 张、无进度条;
侧栏「书籍」带 aria-current
- 顶部导航「书架」href = /bookshelf/
This commit is contained in:
@@ -279,8 +279,10 @@ prose-p:leading-[1.78] md:prose-p:leading-[1.85]
|
|||||||
|
|
||||||
| 页面 | 路径 | 内容 | 侧栏数量 |
|
| 页面 | 路径 | 内容 | 侧栏数量 |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| 书籍 | `/bookshelf/` | 手工书单(`books.json`)+ 微信读书已读完 | 两者相加 |
|
| 在读 | `/bookshelf/` | 微信读书里没读完的 | 未读完本数 |
|
||||||
| 在读 | `/bookshelf/reading/` | 微信读书里没读完的 | 未读完本数 |
|
| 书籍 | `/bookshelf/books/` | 手工书单(`books.json`)+ 微信读书已读完 | 两者相加 |
|
||||||
|
|
||||||
|
顶部导航「书架」指向 `/bookshelf/`,所以点进来先落在**在读**页。
|
||||||
|
|
||||||
两块内容:
|
两块内容:
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -195,7 +195,7 @@ pnpm preview # 本地预览构建产物(搜索功能只有这里才生效
|
|||||||
|
|
||||||
## 7.5 刷新「最近在读」
|
## 7.5 刷新「最近在读」
|
||||||
|
|
||||||
书架分成两个页面:**书籍** `/bookshelf/`、**在读** `/bookshelf/reading/`,侧栏「馆藏」互相跳转。
|
书架分成两个页面:**在读** `/bookshelf/`(顶部导航「书架」的落点)、**书籍** `/bookshelf/books/`,侧栏「馆藏」互相跳转。
|
||||||
|
|
||||||
「在读」是从微信读书抓来的,数据存在 `src/data/reading.json`。
|
「在读」是从微信读书抓来的,数据存在 `src/data/reading.json`。
|
||||||
|
|
||||||
|
|||||||
@@ -124,8 +124,8 @@ const recommendBadge = (status?: string) => {
|
|||||||
{/* 漫画和论文两个分类已移除;在读和书籍现在是两个独立页面,这里是它们的导航 */}
|
{/* 漫画和论文两个分类已移除;在读和书籍现在是两个独立页面,这里是它们的导航 */}
|
||||||
<nav class="flex flex-row md:flex-col gap-1 mb-6 md:mb-8 overflow-x-auto md:overflow-visible -mx-1 px-1">
|
<nav class="flex flex-row md:flex-col gap-1 mb-6 md:mb-8 overflow-x-auto md:overflow-visible -mx-1 px-1">
|
||||||
{[
|
{[
|
||||||
{ href: "/bookshelf/reading/", label: "在读", count: readingCount, svg: "reading", active: isReadingView },
|
{ href: "/bookshelf/", label: "在读", count: readingCount, svg: "reading", active: isReadingView },
|
||||||
{ href: "/bookshelf/", label: "书籍", count: bookStats.total + finishedReading.length, svg: "books", active: !isReadingView },
|
{ href: "/bookshelf/books/", label: "书籍", count: bookStats.total + finishedReading.length, svg: "books", active: !isReadingView },
|
||||||
].map((it) => (
|
].map((it) => (
|
||||||
<a
|
<a
|
||||||
href={it.href}
|
href={it.href}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"updatedAt": "2026-09-15T03:05:33.930Z",
|
"updatedAt": "2026-09-15T03:11:22.026Z",
|
||||||
"source": "weread",
|
"source": "weread",
|
||||||
"books": [
|
"books": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
import BaseLayout from "@/layouts/BaseLayout.astro"
|
||||||
|
import BookshelfContent from "@/components/bookshelf-content.astro"
|
||||||
|
import { siteTitleSuffix } from "@/data/site"
|
||||||
|
|
||||||
|
const title = `书籍 | ${siteTitleSuffix}`
|
||||||
|
const description = "我的阅读记录与书籍推荐"
|
||||||
|
---
|
||||||
|
|
||||||
|
<BaseLayout {title} {description} fontProfile="interface">
|
||||||
|
<BookshelfContent view="books" />
|
||||||
|
</BaseLayout>
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from "@/layouts/BaseLayout.astro"
|
import BaseLayout from "@/layouts/BaseLayout.astro"
|
||||||
import BookshelfContent from "@/components/bookshelf-content.astro"
|
import BookshelfContent from "@/components/bookshelf-content.astro"
|
||||||
|
import { getReadingData } from "@/lib/reading"
|
||||||
import { siteTitleSuffix } from "@/data/site"
|
import { siteTitleSuffix } from "@/data/site"
|
||||||
|
|
||||||
const title = `书籍 | ${siteTitleSuffix}`
|
// 书架默认落在「在读」页,和顶部导航「书架」的落点一致
|
||||||
const description = "我的阅读记录与书籍推荐"
|
const description = "最近在读的书,数据来自微信读书"
|
||||||
|
|
||||||
|
// 用真实本数做标题,抓不到数据时退回通用文案
|
||||||
|
const count = getReadingData()?.books.filter((book) => !book.finished).length ?? 0
|
||||||
|
const heading = count > 0 ? `在读 ${count} 本` : "在读"
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout {title} {description} fontProfile="interface">
|
<BaseLayout title={`${heading} | ${siteTitleSuffix}`} {description} fontProfile="interface">
|
||||||
<BookshelfContent view="books" />
|
<BookshelfContent view="reading" />
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
import BaseLayout from "@/layouts/BaseLayout.astro"
|
|
||||||
import BookshelfContent from "@/components/bookshelf-content.astro"
|
|
||||||
import { getReadingData } from "@/lib/reading"
|
|
||||||
import { siteTitleSuffix } from "@/data/site"
|
|
||||||
|
|
||||||
const title = `在读 | ${siteTitleSuffix}`
|
|
||||||
const description = "最近在读的书,数据来自微信读书"
|
|
||||||
|
|
||||||
// 用真实本数做标题,抓不到数据时退回通用文案
|
|
||||||
const count = getReadingData()?.books.filter((book) => !book.finished).length ?? 0
|
|
||||||
const heading = count > 0 ? `在读 ${count} 本` : "在读"
|
|
||||||
---
|
|
||||||
|
|
||||||
<BaseLayout title={`${heading} | ${siteTitleSuffix}`} {description} fontProfile="interface">
|
|
||||||
<BookshelfContent view="reading" />
|
|
||||||
</BaseLayout>
|
|
||||||
Reference in New Issue
Block a user