@hutusi/amytis 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +23 -16
  3. package/README.zh.md +178 -100
  4. package/content/books/notes-on-thinking/cost-of-certainty.mdx +9 -0
  5. package/content/books/notes-on-thinking/index.mdx +16 -0
  6. package/content/books/notes-on-thinking/mental-models.mdx +9 -0
  7. package/content/books/the-pragmatic-writer/finding-your-voice.mdx +9 -0
  8. package/content/books/the-pragmatic-writer/index.mdx +18 -0
  9. package/content/books/the-pragmatic-writer/the-editing-loop.mdx +9 -0
  10. package/content/books/the-pragmatic-writer/why-writing-matters.mdx +9 -0
  11. package/content/flows/2026/03/01.md +9 -0
  12. package/content/flows/2026/03/03.md +9 -0
  13. package/content/flows/2026/03/05.md +9 -0
  14. package/content/flows/2026/03/07.md +9 -0
  15. package/content/posts/images/vibrant-waves.jpg +0 -0
  16. package/content/posts/welcome-to-amytis.mdx +3 -0
  17. package/content/series/markdown-showcase/index.mdx +2 -1
  18. package/content/series/markdown-showcase/mathematical-notation.mdx +8 -4
  19. package/content/series/markdown-showcase/syntax-highlighting.mdx +9 -5
  20. package/content/series/markdown-showcase/visuals-and-diagrams.mdx +8 -4
  21. package/content/{posts → series/markdown-showcase}//344/270/255/346/226/207/346/265/213/350/257/225/346/226/207/347/253/240.mdx +12 -7
  22. package/package.json +1 -1
  23. package/public/next-image-export-optimizer-hashes.json +3 -2
  24. package/site.config.example.ts +3 -4
  25. package/site.config.ts +6 -7
  26. package/src/app/[slug]/[postSlug]/page.tsx +19 -2
  27. package/src/app/[slug]/page/[page]/page.tsx +26 -5
  28. package/src/app/[slug]/page.tsx +28 -8
  29. package/src/app/page.tsx +0 -2
  30. package/src/app/posts/[slug]/page.tsx +28 -9
  31. package/src/app/series/[slug]/page.tsx +46 -4
  32. package/src/components/CuratedSeriesSection.tsx +7 -11
  33. package/src/components/FeaturedStoriesSection.tsx +1 -1
  34. package/src/components/Footer.tsx +5 -5
  35. package/src/components/HorizontalScroll.tsx +5 -14
  36. package/src/components/PostList.tsx +20 -36
  37. package/src/components/SelectedBooksSection.tsx +65 -25
  38. package/src/components/SeriesCatalog.tsx +9 -7
  39. package/src/i18n/translations.ts +2 -0
  40. package/src/layouts/PostLayout.tsx +1 -1
  41. package/src/layouts/SimpleLayout.tsx +3 -3
  42. package/src/lib/markdown.ts +10 -1
  43. package/src/lib/urls.ts +9 -4
  44. package/tests/e2e/mobile/mobile-compat.spec.ts +58 -0
  45. package/tests/integration/markdown-features.test.ts +3 -3
  46. package/tests/integration/reading-time-headings.test.ts +2 -2
  47. package/tests/unit/static-params.test.ts +155 -22
  48. package/tests/unit/urls.test.ts +10 -12
  49. /package/content/posts/{multilingual-test.mdx → multilingual-test-/344/270/255/346/226/207/351/225/277/346/240/207/351/242/230.mdx"} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.13.0] - 2026-03-25
9
+
10
+ ### Added
11
+ - **Slug Rename Redirects**: Added `redirectFrom` support for post slug renames within the same URL prefix so renamed content can keep resolving from legacy paths.
12
+ - **Series Slug Migration**: Added `redirectFrom` support for series slug renames, preserving access to older series URLs after route changes.
13
+
14
+ ### Changed
15
+ - **Series Routing Defaults**: `series.autoPaths` now defaults to `true`, making `/<series-slug>/<post-slug>` the standard route shape for series posts.
16
+ - **README Positioning**: Updated the English README to match the latest Chinese version, including the project backstory and refreshed documentation structure.
17
+
18
+ ### Fixed
19
+ - **Route Conflict Handling**: Prevented auto-path series slugs from colliding with configured `series.customPaths` values during route generation.
20
+
8
21
  ## [1.12.0] - 2026-03-08
9
22
 
10
23
  ### Added
package/README.md CHANGED
@@ -2,22 +2,37 @@
2
2
 
3
3
  [English](README.md) | [简体中文](README.zh.md)
4
4
 
5
- **Amytis** is an elegant, open-source framework for building a personal digital garden: a living knowledge space where ideas grow from raw notes to refined writing. It is built with Next.js 16, React 19, and Tailwind CSS v4, with a strong focus on readability, structure, and long-term content ownership.
5
+ **Amytis** is a powerful, elegant, and user-friendly open-source digital garden framework for building knowledge spaces, blogs, showcase sites, or internal knowledge bases. It is built with Next.js 16, Tailwind CSS v4, and Bun, emphasizing a Markdown-first, plain-text-first workflow that preserves long-term content ownership while pursuing simplicity, elegance, and performance.
6
6
 
7
7
  [**Live Demo**](https://amytis.vercel.app/)
8
8
 
9
9
  ![Amytis Screenshot](public/images/amytis-screenshot.jpg)
10
10
 
11
- ## The Knowledge Ladder
11
+ ## Why Amytis?
12
12
 
13
- Amytis is built around a simple path from rough to refined:
13
+ I have been [blogging for twenty years](https://hutusi.com/archive), starting from early blogging platforms such as MSN Space (MS Live Space) and Sina Blog, then moving to self-hosted WordPress and Drupal, and later fully adopting static blogging frameworks after GitHub Pages became available. I tried Jekyll, Hugo, and several of their themes, but none of them truly satisfied me. The feature-rich ones were often not simple or elegant enough, while the elegant ones usually lacked flexibility and customization. I kept wondering whether a blogging or knowledge platform framework could balance functionality, performance, aesthetics, and UX. That idea stayed with me for years. When I finally decided to build one myself, I found it much harder than I had expected.
14
14
 
15
- - **Flow**: Capture raw daily thoughts and fragments.
16
- - **Articles**: Refine one idea into a clear essay.
17
- - **Series**: Connect related articles into a curated narrative.
18
- - **Books**: Distill mature knowledge into structured chapters and parts.
15
+ Fortunately, AI coding changed that equation. With the help of Claude Code, Gemini CLI, and Codex, it became much easier than before to turn the idea into reality. After more than 700 commits of iteration, Amytis finally took shape as the idealized knowledge platform framework I had been aiming for. It was first used in the geek community platform I built at work, and I also replaced the framework behind my Hutusi blog with it. Amytis is now open source. Independent bloggers and knowledge managers are welcome to use it, and contributions, bug reports, and pull requests are all appreciated. If you are using Amytis, feel free to leave a note in [this issue](https://github.com/hutusi/amytis/issues/49).
19
16
 
20
- Each stage builds on the previous one, so your garden can evolve naturally.
17
+ ### The Knowledge Ladder
18
+
19
+ Amytis is built around a path from fragmented thoughts to refined knowledge, helping individuals or teams build a complete digital garden system:
20
+
21
+ - **Flow**: Capture daily thoughts and brainstorming fragments.
22
+ - **Articles**: Refine a single idea into a clear article.
23
+ - **Series**: Connect related articles into a thematic narrative.
24
+ - **Books**: Distill mature knowledge into structured, chapter-based books.
25
+
26
+ Each stage builds on the one before it, so the garden can grow naturally.
27
+
28
+ ### Design Philosophy
29
+
30
+ - **Elegance by default**: Typography, spacing, and color should feel polished out of the box and remain visually consistent.
31
+ - **Content and plain text first**: Writing and publishing should happen through file-based workflows rather than a heavyweight CMS. Content lives in Markdown/MDX, can be versioned with Git, and remains portable over time.
32
+ - **Markdown-first, not markdown-limited**: Markdown and common extensions are supported by default, while math, diagrams, code, and bidirectional links remain first-class.
33
+ - **Ship what you need**: `site.config.ts` provides modular switches so you only enable the capabilities you actually need.
34
+
35
+ Further reading: [How to Get AI to Write Better Code](https://hutusi.com/weeklies/25) (Chinese)
21
36
 
22
37
  ## Features
23
38
 
@@ -65,14 +80,6 @@ Each stage builds on the previous one, so your garden can evolve naturally.
65
80
  - **Content CLI Tools:** Create posts, series, and import from PDFs or image folders.
66
81
  - **Modern Stack:** Next.js 16, React 19, Tailwind CSS v4, TypeScript 5, Bun.
67
82
 
68
- ## Design Philosophy
69
-
70
- - **Elegance by default**: Typography, spacing, and color should feel intentional out of the box.
71
- - **Content over configuration**: Writing and publishing should be simple file-based workflows, not CMS-heavy setup.
72
- - **Markdown-first, not markdown-limited**: Keep authoring portable while supporting rich output (math, diagrams, code, wikilinks).
73
- - **Ship what you need**: Features are modular through `site.config.ts`; disable sections you do not use.
74
- - **Plain text, long-term ownership**: Content stays in Markdown/MDX so it remains versionable and portable.
75
-
76
83
  ## Quick Start
77
84
 
78
85
  ### New Project (Recommended)
package/README.zh.md CHANGED
@@ -2,73 +2,89 @@
2
2
 
3
3
  [English](README.md) | [简体中文](README.zh.md)
4
4
 
5
- **Amytis** 是一个优雅的开源数字花园框架,用于构建个人知识空间。它基于 Next.js 16、React 19Tailwind CSS v4,强调可读性、结构化表达与长期内容所有权。
5
+ **Amytis** 是一个功能强大、设计优雅、交互友好的开源数字花园框架,用于构建知识空间、博客、展示页面或企业知识库等。它基于 Next.js 16、Tailwind CSS v4 Bun 构建,强调 Markdown 优先、文本优先,保障作者对内容的长期所有权,在不损失功能和性能的前提下追求极致简洁与优雅。
6
6
 
7
7
  [**在线演示**](https://amytis.vercel.app/)
8
8
 
9
9
  ![Amytis 截图](public/images/amytis-screenshot.jpg)
10
10
 
11
- ## 知识阶梯
11
+ ## 为什么要做 Amytis ?
12
12
 
13
- Amytis 围绕一条从粗糙到精炼的知识路径构建:
13
+ 我写[博客有二十年](https://hutusi.com/archive)了,从最早的博客平台,如 MSN Space (MS Live Space)、新浪博客,到自己搭建 Wordpress、Drupal, 再到 GitHub Pages 推出后全面采用静态博客框架,折腾过 Jekyll、Hugo 及其多个主题,但没有一个框架或主题能让自己真正满意。功能复杂的不够简洁或优雅,简洁优雅的又缺少功能定制。能不能有一款兼顾功能、性能、美观、UX 的博客或知识平台框架呢?这个想法最近几年一直萦绕在我的脑海,实在找不到那就做一个,等到准备付诸实践,才发现难度比想象中的要大得多。
14
14
 
15
- - **Flow(随笔)**:记录每日想法与碎片。
16
- - **Articles(文章)**:将单个想法打磨成清晰文章。
15
+ 好在有 AI 编程,在 Claude Code/Gemini CLI/Codex 的帮助下,比以往要更容易实现自己的想法,在经过 700 多次 Commit 的打磨后,理想化的知识平台框架 —— Amytis 终于交付成稿,我在公司搭建的极客社区平台首次应用,并将胡涂说博客网站框架也进行了替换。同时,也将 Amytis 开源,欢迎更多的独立博主/知识管理者使用,更欢迎帮忙发现问题、提 PR 添砖加瓦。如果你也在使用 Amytis, 欢迎在[此 issue 留言](https://github.com/hutusi/amytis/issues/49)。
16
+
17
+ ### 知识阶梯
18
+
19
+ Amytis 围绕一条从碎片想法到精炼知识的路径来帮助个人或组织构建完整的数字花园体系:
20
+
21
+ - **Flow(心流)**:记录每日想法与头脑风暴的灵感碎片。
22
+ - **Articles(文章)**:将单个想法打磨成清晰的文章。
17
23
  - **Series(系列)**:把相关文章串联为一条主题叙事。
18
- - **Books(书籍)**:将成熟知识沉淀为章节化结构。
24
+ - **Books(书籍)**:将成熟知识沉淀为章节化结构的书籍。
19
25
 
20
- 每个阶段都建立在上一阶段之上,花园会自然生长。
26
+ 每个阶段都建立在上一阶段之上,数字花园会自然生长。
21
27
 
22
- ## 功能特性
28
+ ### 设计理念
23
29
 
24
- - **数字花园体验**:通过标签、系列、作者、书籍、Flow 和归档进行非线性导航。
25
- - **互联知识网络**:
26
- - **双向链接**:支持 `[[Slug]]` 跨内容类型关联。
27
- - **反向链接**:在笔记页自动显示“Linked References”。
28
- - **知识图谱**:以可视化方式展示内容连接关系。
29
- - **全文搜索**:基于 Pagefind 的静态搜索,支持 Cmd/Ctrl+K 快捷键。
30
- - **结构化内容体系**:
31
- - **Series**:支持手动或自动排序的多篇集合。
32
- - **Books**:支持章节与分部的长篇阅读界面。
33
- - **Notes**:原子化常青笔记。
34
- - **Flows**:流式日记/微记录。
35
- - **富文本 MDX 能力**:
36
- - GitHub Flavored Markdown(表格、任务列表等)
37
- - 代码高亮
38
- - Mermaid 图表
39
- - KaTeX 数学公式
40
- - 原生 HTML 支持
41
- - **阅读体验与设计**:
42
- - 高可读排版与响应式布局
43
- - 自动系统主题检测(明/暗)
44
- - 四套配色主题:default、blue、rose、amber
45
- - 吸顶目录与阅读进度跟踪
46
- - **作者生态**:每位作者有独立主页,包含简介、头像与社交链接。文章支持按作者筛选,并可在文末显示作者卡片。
47
- - **性能与 SEO**:
48
- - 全静态导出与 WebP 优化
49
- - 每种内容类型均有完整的 Open Graph 与 Twitter Card 元数据
50
- - JSON-LD 结构化数据(`BlogPosting`、`Book`、`Article`),支持 Google 富媒体搜索结果
51
- - RSS/Atom 订阅源,格式(`rss` | `atom` | `both`)与内容深度(`full` | `excerpt`)可配置
52
- - `<head>` 自动注入 Feed 发现链接,原生 sitemap 生成
53
- - 支持 Latin/CJK 的多语言阅读时长估算
54
- - **集成能力**:
55
- - 统计:Umami / Plausible / Google Analytics
56
- - 评论:Giscus / Disqus
57
- - i18n:`site.config.ts` 中配置多语言(en / zh)
58
-
59
- ## 设计理念
60
-
61
- - **默认优雅**:排版、间距、色彩开箱即用且有审美一致性。
62
- - **内容优先**:通过文件化写作与发布流程完成创作,不依赖重型 CMS。
63
- - **Markdown 优先但不受限**:保持可迁移写作体验,同时支持数学、图表、代码和双向链接。
30
+ - **简洁优雅**:排版、间距、配色开箱即用,且遵循审美一致性。
31
+ - **内容及文本优先**:通过文本文件化写作与发布流程完成创作,不依赖重型 CMS,内容存储于 Markdown/MDX 文本,结合 Git 进行版本管理,使作者拥有长期所有权并便于平台迁移。
32
+ - **Markdown 优先**:默认支持 Markdown 及常用扩展语法,同时支持数学、图表、代码和双向链接。
64
33
  - **按需启用**:`site.config.ts` 提供模块化开关,仅启用你需要的能力。
65
- - **纯文本长期所有权**:内容存储于 Markdown/MDX,便于版本管理与长期迁移。
34
+
35
+ 延伸阅读:[《如何让 AI 写好代码》](https://hutusi.com/weeklies/25)(中文)
36
+
37
+ ## 功能特性
38
+
39
+ - **数字花园理念:** 通过标签、系列、作者、书籍、Flow 和时间归档实现非线性导航。
40
+ - **互联知识网络:**
41
+ - **Wiki 链接:** 支持在所有内容类型之间使用 `[[Slug]]` 建立双向关联。
42
+ - **反向链接:** 在笔记页面自动展示 “Linked References”。
43
+ - **知识图谱:** 以交互式可视化方式展示内容之间的连接关系。
44
+ - **全文搜索:** 基于 Pagefind 的快速静态客户端全文搜索,支持 Cmd/Ctrl+K。
45
+ - **结构化内容体系:**
46
+ - **Series:** 支持手动或自动排序的多篇内容组织方式。
47
+ - **Books:** 支持明确章节、分部以及专用阅读界面的长篇内容。
48
+ - **Notes:** 面向个人知识管理的原子化常青概念。
49
+ - **Flows:** 用于快速记录想法的流式日记或微博客。
50
+ - **丰富的 MDX 内容能力:**
51
+ - GitHub Flavored Markdown(表格、任务列表、删除线)。
52
+ - 语法高亮代码块。
53
+ - Mermaid 图表(流程图、时序图等)。
54
+ - 通过 KaTeX 支持 LaTeX 数学公式。
55
+ - 支持原生 HTML 以实现自定义布局。
56
+ - **优雅设计:**
57
+ - 极简审美与高对比度排版。
58
+ - 明暗主题,自动跟随系统设置。
59
+ - 四套配色方案: default(emerald)、blue、rose、amber。
60
+ - 针对阅读优化的响应式布局。
61
+ - 首页精选内容支持横向滚动。
62
+ - **目录:** 吸顶目录支持滚动跟踪、阅读进度指示和当前标题高亮。
63
+ - **灵活的内容结构:**
64
+ - 支持平铺文件(`post.mdx`)或嵌套文件夹(`post/index.mdx`)。
65
+ - 资源可与文章共置: 将图片保存在文章目录内(`./images/`)。
66
+ - 支持带日期前缀的文件名: `2026-01-01-my-post.mdx`。
67
+ - 支持文章、系列、书籍和 Flows 的草稿状态。
68
+ - **作者生态:** 每位作者都有独立主页,包含简介、头像和社交链接。文章可按作者筛选,文末可选显示作者卡片。
69
+ - **性能与 SEO:**
70
+ - 全静态导出,并生成优化后的 WebP 图片。
71
+ - 为所有内容类型生成 Open Graph 和 Twitter Card 元数据。
72
+ - 提供 JSON-LD 结构化数据(`BlogPosting`、`Book`、`Article`),支持 Google 富媒体结果。
73
+ - RSS/Atom 订阅源支持可配置的格式(`rss` | `atom` | `both`)和内容深度(`full` | `excerpt`)。
74
+ - 在 `<head>` 中自动注入 Feed 自动发现链接,并原生生成 sitemap。
75
+ - 多语言阅读时长估算,支持 Latin 和 CJK。
76
+ - **集成能力:**
77
+ - 分析统计: Umami、Plausible 或 Google Analytics。
78
+ - 评论系统: Giscus(GitHub Discussions)或 Disqus。
79
+ - 国际化: 通过本地化的 `site.config.ts` 支持多语言(en、zh)。
80
+ - **内容 CLI 工具:** 支持创建文章、系列,以及从 PDF 或图片文件夹导入内容。
81
+ - **现代技术栈:** Next.js 16、React 19、Tailwind CSS v4、TypeScript 5、Bun。
66
82
 
67
83
  ## 快速开始
68
84
 
69
85
  ### 新建项目(推荐)
70
86
 
71
- 一条命令创建新的 Amytis 站点:
87
+ 用一条命令创建新的 Amytis 站点:
72
88
 
73
89
  ```bash
74
90
  bun create amytis my-garden
@@ -76,30 +92,36 @@ cd my-garden
76
92
  bun dev
77
93
  ```
78
94
 
79
- 该脚手架会下载最新发布版 Amytis,自动安装依赖,并根据你的项目信息更新 `site.config.ts` 和 `package.json`。
95
+ 脚手架命令会下载最新打标签发布的 Amytis 版本,安装依赖,并根据你的项目信息更新 `site.config.ts` 和 `package.json`。
80
96
 
81
- ### 克隆运行
97
+ ### 克隆并运行
98
+
99
+ 1. **安装依赖:**
82
100
 
83
- 1. **安装依赖**
84
101
  ```bash
85
102
  bun install
86
103
  ```
87
104
 
88
- 2. **启动开发环境**
105
+ 2. **启动开发服务器:**
106
+
89
107
  ```bash
90
108
  bun dev
91
109
  ```
92
- 打开 [http://localhost:3000](http://localhost:3000)。
93
110
 
94
- > **本地搜索说明:** Pagefind 索引是在执行 `bun run build:dev` 时生成的。本地测试 Cmd/Ctrl+K 前先运行一次;内容更新后也需要重新生成。
111
+ 访问 [http://localhost:3000](http://localhost:3000)。
112
+
113
+ > **开发环境中的搜索:** Pagefind 索引会在执行 `bun run build:dev` 时生成。本地测试 Cmd/Ctrl+K 前请先运行一次;内容更新后也需要重新生成。
114
+
115
+ 3. **生产构建(静态导出):**
95
116
 
96
- 3. **生产构建(静态导出)**
97
117
  ```bash
98
118
  bun run build
99
119
  ```
100
- 产物位于 `out/` 目录。
101
120
 
102
- 4. **开发构建(更快,无图片优化)**
121
+ 静态站点会生成到 `out/` 目录,并包含优化后的图片资源。
122
+
123
+ 4. **开发构建(更快,无图片优化):**
124
+
103
125
  ```bash
104
126
  bun run build:dev
105
127
  ```
@@ -117,7 +139,7 @@ bun run validate
117
139
  bun run build
118
140
  bun run build:dev
119
141
  bun run clean
120
- bun run deploy # 部署到 Linux/nginx 服务器(需要 .env.local 配置)
142
+ bun run deploy # 部署到 Linux/nginx 服务器(需要 .env.local
121
143
 
122
144
  ## Test
123
145
  bun test
@@ -144,81 +166,137 @@ bun run series-draft "series-slug"
144
166
  bun run add-series-redirects --dry-run
145
167
  ```
146
168
 
147
- ### 导入聊天记录到 Flows
169
+ ### 将聊天记录导入为 Flows
148
170
 
149
- 将 `.txt` 或 `.log` 文件放入 `imports/chats/` 后执行:
171
+ 将 `.txt` 或 `.log` 文件放入 `imports/chats/`,然后执行:
150
172
 
151
173
  ```bash
152
174
  bun run new-flow-from-chat
153
175
  ```
154
176
 
155
- 常用参数:`--all`、`--dry-run`、`--author "Name"`、`--append`、`--timestamp`。
156
- 导入历史记录位于 `imports/chats/.imported`。
177
+ 常用参数: `--all`、`--dry-run`、`--author "Name"`、`--append`、`--timestamp`。
178
+ 导入历史会记录在 `imports/chats/.imported` 中。
157
179
 
158
180
  ## 配置
159
181
 
160
- 主要站点配置集中在 `site.config.ts`,`site.config.example.ts` 则是更完整的参考模板,适合查看可选项和默认写法。
182
+ 主要站点配置位于 `site.config.ts`。`site.config.example.ts` 是脚手架所使用的参考模板,查看新选项时很有用:
183
+
184
+ ```typescript
185
+ export const siteConfig = {
186
+ // ...
187
+ nav: [
188
+ { name: "Home", url: "/", weight: 1 },
189
+ { name: "Flow", url: "/flows", weight: 1.1 }, // 在导航中添加 Flows
190
+ { name: "Series", url: "/series", weight: 1.5 },
191
+ { name: "Books", url: "/books", weight: 1.7 },
192
+ { name: "Archive", url: "/archive", weight: 2 },
193
+ // ...
194
+ ],
195
+ // ...
196
+ flows: {
197
+ recentCount: 5,
198
+ },
199
+ };
200
+ ```
161
201
 
162
- 优先关注这些配置区块:
202
+ 优先自定义这些高影响配置区块:
163
203
 
164
- - 站点信息:`title`、`description`、`baseUrl`、`ogImage`、`logo`
165
- - 导航与页脚:`nav`、`footer`、`subscribe`、`social`
166
- - 内容路由:`posts.basePath`、`posts.includeDateInUrl`、`series.autoPaths`、`series.customPaths`
167
- - 首页结构:`hero`、`homepage.sections`
168
- - 集成能力:`analytics`、`comments`、`feed`、`i18n`
204
+ - 站点标识: `title`、`description`、`baseUrl`、`ogImage`、`logo`
205
+ - 导航与页脚: `nav`、`footer`、`subscribe`、`social`
206
+ - 内容行为: `posts.basePath`、`posts.includeDateInUrl`、`series.autoPaths`、`series.customPaths`
207
+ - 首页组成: `hero`、`homepage.sections`
208
+ - 集成能力: `analytics`、`comments`、`feed`、`i18n`
169
209
 
170
- 如果你部署到 nginx,可直接从 `nginx.conf.example` 开始调整。
210
+ 如果是通过 nginx 进行静态托管,可以从 `nginx.conf.example` 开始配置。
171
211
 
172
212
  ## 静态导出路由规则
173
213
 
174
- Amytis 基于 Next.js 静态导出,核心约束是 `output: "export"` 和 `trailingSlash: true`。
214
+ Amytis 基于 Next.js 静态导出构建,关键配置为 `output: "export"` 和 `trailingSlash: true`。
175
215
 
176
- - 在 `generateStaticParams()` 中返回原始路径片段,不要手动用 `encodeURIComponent`
177
- - 链接必须指向真实路径,例如 `/posts/中文测试文章`,不要写 `/posts/[slug]`
178
- - 文章默认路径是 `/<posts.basePath>/<slug>`,其中 `posts.basePath` 默认值为 `/posts`
179
- - 启用 `series.autoPaths` 后,系列文章会切换到 `/<series-slug>/<post-slug>`
180
- - 配置了 `series.customPaths` 时,会优先使用自定义前缀覆盖 `autoPaths`
181
- - 如果准备把系列文章从默认 `/posts/...` 路径迁走,先执行 `bun run add-series-redirects --dry-run`,确认后再执行 `bun run add-series-redirects`
216
+ - 在 `generateStaticParams()` 中返回原始 segment 值,不要预先用 `encodeURIComponent` 编码。
217
+ - 链接应指向真实 URL,例如 `/posts/中文测试文章`,而不是 `/posts/[slug]` 这样的路由占位符。
218
+ - 文章默认路径为 `/<posts.basePath>/<slug>`,其中 `posts.basePath` 默认值为 `/posts`。
219
+ - 启用 `series.autoPaths` 后,系列文章会移动到 `/<series-slug>/<post-slug>`。
220
+ - 如果配置了 `series.customPaths`,则会以这些自定义前缀覆盖 `autoPaths`。
221
+ - 在把系列文章从默认的 posts 路径迁走之前,先运行 `bun run add-series-redirects --dry-run`,再执行 `bun run add-series-redirects`,以确保旧链接仍然可访问。
182
222
 
183
223
  ## 内容写作
184
224
 
185
- - **Posts**:写入 `content/posts/`,支持单文件、日期前缀和文件夹模式。文件夹模式可将图片放在同目录的 `images/` 中。CLI:`bun run new "Post Title"` 或 `bun run new "Post Title" --folder`
186
- - **Flows**:写入 `content/flows/YYYY/MM/DD.md` 或 `.mdx`。CLI:`bun run new-flow`
187
- - **Series**:创建 `content/series/<slug>/index.mdx`,系列内文章可作为同级文件或子目录。CLI:`bun run new-series "Series Name"`
188
- - **Books**:写入 `content/books/<slug>/`,通常用 `index.mdx` 存元数据,其余章节文件与其并列
189
- - **Notes**:写入 `content/notes/`,支持 `[[wiki-links]]`。CLI:`bun run new-note "Concept"`
190
- - **Unicode slug**:文章和笔记支持有意使用 Unicode slug,修改动态路由时要一起验证 ASCII 和 Unicode 路径
225
+ ### Posts
226
+
227
+ `content/posts/` 中创建 `.md` `.mdx` 文件。
228
+
229
+ - 平铺文件: `content/posts/my-post.mdx`
230
+ - 日期前缀文件: `content/posts/2026-01-01-my-post.mdx`
231
+ - 带共置资源的文件夹文章: `content/posts/my-post/index.mdx`,并配合 `content/posts/my-post/images/*`
232
+ - CLI: `bun run new "Post Title"` 或 `bun run new "Post Title" --folder`
233
+
234
+ ### Flows
235
+
236
+ 在 `content/flows/YYYY/MM/DD.md` 或 `.mdx` 中创建日记内容。
237
+
238
+ - CLI: `bun run new-flow` 会创建今天的记录
239
+ - 聊天导入: 将导出文件放入 `imports/chats/`,然后运行 `bun run new-flow-from-chat`
240
+
241
+ ### Series
242
+
243
+ 在 `content/series/<slug>/` 下创建目录和 `index.mdx`,然后将系列文章作为同级文件或文件夹加入其中。
244
+
245
+ - CLI: `bun run new-series "Series Name"`
246
+ - 也可以直接将文章创建到已有系列中: `bun run new "Post Title" --series <series-slug>`
247
+
248
+ ### Books
249
+
250
+ 书籍是位于 `content/books/<slug>/` 下的长篇结构化内容。
251
+
252
+ - 使用 `index.mdx` 保存书籍元数据
253
+ - 在同目录添加章节文件,例如 `introduction.mdx` 或 `setup.mdx`
254
+ - 与书籍相关的工作流可使用 `bun run import-book` 和 `bun run sync-book`
255
+
256
+ ### Notes
257
+
258
+ 在 `content/notes/` 中创建常青笔记(例如 `concept.mdx`),并使用 `[[wiki-links]]` 将它们连接起来。
259
+
260
+ - CLI: `bun run new-note "Concept"`
261
+ - 在需要时,Notes 和 Posts 都支持有意使用 Unicode slug
191
262
 
192
263
  ## 项目结构
193
264
 
194
265
  ```text
195
266
  amytis/
196
267
  content/
197
- posts/
198
- series/
199
- books/
200
- notes/
201
- flows/
202
- docs/
203
- imports/
204
- public/
205
- scripts/
268
+ posts/ # 博客文章
269
+ series/ # 系列集合
270
+ books/ # 长篇书籍
271
+ notes/ # 数字花园笔记
272
+ flows/ # 日记内容(YYYY/MM/DD)
273
+ about.mdx # 静态页面
274
+ docs/ # 架构、部署、排障文档
275
+ imports/ # 仅本地使用的导入源文件
276
+ public/ # 静态资源
277
+ scripts/ # Bun 编写/构建/导入工具
206
278
  src/
207
- app/
208
- components/
279
+ app/ # Next.js App Router 页面
280
+ books/ # 书籍路由
281
+ notes/ # 笔记路由
282
+ graph/ # 知识图谱
283
+ flows/ # Flow 路由
284
+ components/ # React 组件
209
285
  lib/
210
- tests/
286
+ markdown.ts # 数据访问层
287
+ tests/ # 单元、集成、e2e、工具测试
211
288
  packages/
212
- create-amytis/
213
- site.config.ts
289
+ create-amytis/ # `bun create amytis` 脚手架 CLI
290
+ site.config.ts # 站点配置
214
291
  ```
215
292
 
216
293
  ## 文档
217
294
 
218
- - [架构说明](docs/ARCHITECTURE.md)
295
+ - [架构总览](docs/ARCHITECTURE.md)
219
296
  - [部署指南](docs/deployment.md)
220
297
  - [数字花园指南](docs/DIGITAL_GARDEN.md)
221
298
  - [贡献指南](docs/CONTRIBUTING.md)
299
+ - [故障排查](docs/TROUBLESHOOTING.md)
222
300
 
223
301
  ## 许可证
224
302
 
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: "The Cost of Certainty"
3
+ ---
4
+
5
+ Certainty feels good. It reduces anxiety and speeds up decisions. But it comes at a cost: when you are certain, you stop looking for disconfirming evidence.
6
+
7
+ Most mistakes in reasoning come not from ignorance but from misplaced confidence. The antidote is not permanent doubt — that is paralyzing — but calibrated uncertainty. Ask: how confident am I, and what would change my mind?
8
+
9
+ Holding beliefs loosely is not weakness. It is the posture of someone who cares more about being right than about being consistent.
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: "Notes on Thinking"
3
+ excerpt: "A collection of short essays on mental models, decision-making, and the habits that sharpen how we reason about hard problems."
4
+ date: "2026-03-01"
5
+ coverImage: "text:NT"
6
+ featured: true
7
+ draft: false
8
+ authors: ["Amytis"]
9
+ chapters:
10
+ - title: "Mental Models Are Maps"
11
+ id: "mental-models"
12
+ - title: "The Cost of Certainty"
13
+ id: "cost-of-certainty"
14
+ ---
15
+
16
+ **Notes on Thinking** is a short collection of essays on how to reason more clearly. Each chapter is self-contained and can be read in any order.
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: "Mental Models Are Maps"
3
+ ---
4
+
5
+ A mental model is a simplified representation of how something works. Like a map, it is useful precisely because it leaves things out. A map that showed every detail would be as large and complex as the territory itself — useless for navigation.
6
+
7
+ The best mental models are wrong in the right ways. They omit the details that don't matter for the decision at hand, while preserving the structure that does.
8
+
9
+ Collecting mental models from many fields — physics, economics, biology, psychology — gives you a richer toolkit for making sense of new situations.
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: "Finding Your Voice"
3
+ ---
4
+
5
+ Voice is not something you invent — it is something you stop suppressing. Most people who feel they lack a writing voice are simply trying too hard to sound like someone else.
6
+
7
+ The quickest path to your own voice is to write the way you explain things to a friend: directly, without jargon, without hedging every sentence. Read it back. Does it sound like you? If not, cut the parts that don't.
8
+
9
+ Over time, patterns emerge. Certain words recur. Certain sentence structures feel natural. That accumulation is your voice.
@@ -0,0 +1,18 @@
1
+ ---
2
+ title: "The Pragmatic Writer"
3
+ excerpt: "A practical guide to writing clearly, consistently, and with purpose — for developers, makers, and anyone who thinks in public."
4
+ date: "2026-02-01"
5
+ coverImage: "text:PW"
6
+ featured: true
7
+ draft: false
8
+ authors: ["Amytis"]
9
+ chapters:
10
+ - title: "Why Writing Matters"
11
+ id: "why-writing-matters"
12
+ - title: "Finding Your Voice"
13
+ id: "finding-your-voice"
14
+ - title: "The Editing Loop"
15
+ id: "the-editing-loop"
16
+ ---
17
+
18
+ **The Pragmatic Writer** is a short, opinionated guide to writing as a craft and a habit. It is aimed at people who write to think, share, and build — not to become novelists, but to communicate better.
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: "The Editing Loop"
3
+ ---
4
+
5
+ First drafts are for getting ideas out. Editing is where writing actually happens.
6
+
7
+ A simple loop that works: write a rough draft without stopping, then read it aloud. Your ear will catch what your eye misses — the sentence that trails off, the paragraph that repeats itself, the word that almost means what you intended.
8
+
9
+ Cut ruthlessly. If a sentence does not add information or move the reader forward, remove it. Good writing is not about saying everything; it is about saying the right things.
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: "Why Writing Matters"
3
+ ---
4
+
5
+ Writing is thinking made visible. When you write, you are forced to clarify vague ideas, spot contradictions, and fill gaps you didn't know existed.
6
+
7
+ For developers and makers, writing is also a multiplier. A well-written README, a clear design document, or a concise post about something you learned can save hours for your future self and for everyone else who encounters your work.
8
+
9
+ The goal of this book is not to make you a better stylist. It is to make writing feel less like a chore and more like a useful tool you reach for naturally.
@@ -0,0 +1,9 @@
1
+ ---
2
+ tags: ["react", "performance"]
3
+ ---
4
+
5
+ Spent the afternoon profiling a React app with too many unnecessary re-renders. The culprit was a context provider wrapping the entire tree that updated on every keystroke.
6
+
7
+ The fix was straightforward — split the context into a read context and a dispatch context. Components that only consume state no longer re-render when actions are dispatched. Dropped re-render count from ~80 to ~12 per interaction.
8
+
9
+ Worth revisiting `useMemo` and `useCallback` placement as well. They are often added too eagerly before profiling, and sometimes removed too eagerly after.
@@ -0,0 +1,9 @@
1
+ ---
2
+ tags: ["writing", "note-taking"]
3
+ ---
4
+
5
+ Tried a new approach to note-taking today: writing a one-paragraph summary immediately after reading something, without looking back at the source.
6
+
7
+ If you can't summarize it from memory, you haven't understood it yet. The constraint forces you to identify the actual core idea rather than collecting sentences that sound important.
8
+
9
+ Been doing this for a week. The notes are shorter, less polished, and far more useful.
@@ -0,0 +1,9 @@
1
+ ---
2
+ tags: ["typescript", "tooling"]
3
+ ---
4
+
5
+ Finally moved a mid-sized project from JSDoc type comments to proper TypeScript. The migration took about half a day — less than expected.
6
+
7
+ The biggest win is not autocompletion or error catching (though those matter). It is that the types act as documentation that stays in sync with the code. Prose comments lie; types don't compile if they do.
8
+
9
+ One friction point: `strict: true` surfaces a lot of implicit `any` that was quietly hiding real assumptions. Fixing each one forced me to think about what the code actually expected — which is the point.
@@ -0,0 +1,9 @@
1
+ ---
2
+ tags: ["ai", "workflow"]
3
+ ---
4
+
5
+ Been using Claude Code for a week now as a daily coding assistant. A few observations so far.
6
+
7
+ It is most useful for tasks where the shape of the solution is clear but the execution is tedious — refactoring, writing tests, tracking down why a CSS rule isn't applying. For genuinely novel design problems, talking through the approach matters more than generating code.
8
+
9
+ The most important habit: read every diff before accepting it. Not because the code is wrong (it usually isn't), but because understanding what changed keeps you in the loop on your own codebase.
@@ -5,12 +5,15 @@ excerpt: "The first seeds of our digital garden."
5
5
  category: "General"
6
6
  tags: ["introduction", "digital garden", "nextjs"]
7
7
  author: "Amytis Team"
8
+ coverImage: "images/vibrant-waves.jpg"
8
9
  ---
9
10
 
10
11
  # Welcome to Amytis
11
12
 
12
13
  This is your new digital garden. Built with **Next.js**, **Tailwind CSS**, and **Bun**.
13
14
 
15
+ ![](images/vibrant-waves.jpg)
16
+
14
17
  ## Why Amytis?
15
18
 
16
19
  Amytis of Media was the wife of Nebuchadnezzar II, for whom the Hanging Gardens of Babylon were reportedly built. This digital garden is a space for thoughts to grow and flourish.
@@ -5,7 +5,8 @@ date: "2026-02-13"
5
5
  coverImage: "/images/lake.jpg"
6
6
  featured: true
7
7
  sort: "manual"
8
- posts: ["visuals-and-diagrams", "mathematical-notation", "syntax-highlighting"]
8
+ redirectFrom:
9
+ - /series/markdown-showcase-old
9
10
  ---
10
11
 
11
12
  Amytis supports a wide range of MDX features. This series serves as both a reference and a demonstration.
@@ -1,9 +1,13 @@
1
1
  ---
2
- title: "Mathematical Notation"
3
- date: "2026-02-14"
4
- category: "Science"
5
- tags: ["math", "latex"]
2
+ title: Mathematical Notation
3
+ date: '2026-02-14'
4
+ category: Science
5
+ tags:
6
+ - math
7
+ - latex
6
8
  latex: true
9
+ redirectFrom:
10
+ - /posts/mathematical-notation-demo
7
11
  ---
8
12
 
9
13
  Amytis uses `rehype-katex` to render beautiful mathematical formulas.