@hutusi/amytis 1.12.0 → 1.14.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.
- package/CHANGELOG.md +29 -0
- package/GEMINI.md +9 -1
- package/README.md +26 -17
- package/README.zh.md +180 -100
- package/bun.lock +78 -74
- package/content/books/notes-on-thinking/cost-of-certainty.mdx +9 -0
- package/content/books/notes-on-thinking/index.mdx +16 -0
- package/content/books/notes-on-thinking/mental-models.mdx +9 -0
- package/content/books/the-pragmatic-writer/finding-your-voice.mdx +9 -0
- package/content/books/the-pragmatic-writer/index.mdx +18 -0
- package/content/books/the-pragmatic-writer/the-editing-loop.mdx +9 -0
- package/content/books/the-pragmatic-writer/why-writing-matters.mdx +9 -0
- package/content/flows/2026/03/01.md +9 -0
- package/content/flows/2026/03/03.md +9 -0
- package/content/flows/2026/03/05.md +10 -0
- package/content/flows/2026/03/07.md +11 -0
- package/content/posts/images/vibrant-waves.jpg +0 -0
- package/content/posts/welcome-to-amytis.mdx +3 -0
- package/content/series/markdown-showcase/index.mdx +2 -1
- package/content/series/markdown-showcase/mathematical-notation.mdx +8 -4
- package/content/series/markdown-showcase/syntax-highlighting.mdx +9 -5
- package/content/series/markdown-showcase/visuals-and-diagrams.mdx +8 -4
- 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
- package/content/series/modern-web-dev/index.mdx +4 -2
- package/docs/ARCHITECTURE.md +8 -1
- package/docs/DIGITAL_GARDEN.md +22 -1
- package/package.json +12 -12
- package/public/next-image-export-optimizer-hashes.json +3 -2
- package/scripts/new-flow.ts +1 -0
- package/site.config.example.ts +3 -4
- package/site.config.ts +6 -7
- package/src/app/[slug]/[postSlug]/page.tsx +19 -2
- package/src/app/[slug]/page/[page]/page.tsx +26 -5
- package/src/app/[slug]/page.tsx +28 -8
- package/src/app/all.atom/route.ts +7 -0
- package/src/app/all.xml/route.ts +7 -0
- package/src/app/archive/page.tsx +7 -4
- package/src/app/feed.atom/route.ts +2 -57
- package/src/app/feed.xml/route.ts +2 -64
- package/src/app/flows/[year]/[month]/[day]/page.tsx +13 -0
- package/src/app/flows/feed.atom/route.ts +7 -0
- package/src/app/flows/feed.xml/route.ts +7 -0
- package/src/app/page.tsx +1 -2
- package/src/app/posts/[slug]/page.tsx +28 -9
- package/src/app/posts/feed.atom/route.ts +9 -0
- package/src/app/posts/feed.xml/route.ts +9 -0
- package/src/app/series/[slug]/page.tsx +46 -4
- package/src/components/CuratedSeriesSection.tsx +7 -11
- package/src/components/FeaturedStoriesSection.tsx +1 -1
- package/src/components/FlowCalendarSidebar.tsx +1 -1
- package/src/components/FlowContent.tsx +2 -1
- package/src/components/FlowTimelineEntry.tsx +7 -1
- package/src/components/Footer.tsx +6 -6
- package/src/components/HorizontalScroll.tsx +5 -14
- package/src/components/MarkdownRenderer.test.tsx +6 -0
- package/src/components/MarkdownRenderer.tsx +18 -16
- package/src/components/Navbar.tsx +1 -1
- package/src/components/PostList.tsx +20 -36
- package/src/components/PostSidebar.tsx +1 -1
- package/src/components/RecentNotesSection.tsx +4 -0
- package/src/components/SelectedBooksSection.tsx +65 -25
- package/src/components/SeriesCatalog.tsx +9 -7
- package/src/i18n/translations.ts +2 -0
- package/src/layouts/PostLayout.tsx +1 -1
- package/src/layouts/SimpleLayout.tsx +3 -3
- package/src/lib/feed-utils.ts +158 -18
- package/src/lib/markdown.ts +26 -5
- package/src/lib/urls.ts +9 -4
- package/tests/e2e/mobile/mobile-compat.spec.ts +58 -0
- package/tests/e2e/navigation.test.ts +26 -0
- package/tests/integration/collections.test.ts +17 -2
- package/tests/integration/feed-utils.test.ts +52 -0
- package/tests/integration/flow-title.test.ts +53 -0
- package/tests/integration/markdown-features.test.ts +3 -3
- package/tests/integration/reading-time-headings.test.ts +2 -2
- package/tests/unit/static-params.test.ts +155 -22
- package/tests/unit/urls.test.ts +10 -12
- /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,35 @@ 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.14.0] - 2026-04-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Type-Specific Feeds**: Introduced dedicated RSS and Atom feed endpoints for `/posts/feed.xml`, `/flows/feed.xml`, and a global `/all.xml` firehose, allowing readers to subscribe to specific content streams.
|
|
12
|
+
- **Namespaced Collections**: Collection items now support `folder/slug` syntax (e.g., `posts/my-post`, `web-dev/intro`) for explicit resolution, preventing slug collisions across different content directories.
|
|
13
|
+
- **Enhanced Feed Metadata**: Added RFC 4287 compliant author fallbacks for Atom feeds and optimized feed generation with lazy HTML rendering.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **Copy-Paste UX**: Wrapped article content in background-stable containers to prevent "striping" when pasting into rich-text editors and applied `select-none` to navigation and sidebars for cleaner content selection.
|
|
17
|
+
- **Archive Page Robustness**: Refactored the chronological archive layout to prioritize titles and gracefully truncate long author lists, preventing layout shifts on posts with many contributors.
|
|
18
|
+
- **Test Coverage**: Added comprehensive integration tests for namespaced resolution and E2E tests for the new feed architecture.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **XML Template Literals**: Fixed a syntax issue with escaped backticks in the RSS/Atom generator that caused build-time errors.
|
|
22
|
+
- **Archive Mobile Layout**: Improved layout stability on mobile devices for archive timeline entries.
|
|
23
|
+
|
|
24
|
+
## [1.13.0] - 2026-03-25
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **Slug Rename Redirects**: Added `redirectFrom` support for post slug renames within the same URL prefix so renamed content can keep resolving from legacy paths.
|
|
28
|
+
- **Series Slug Migration**: Added `redirectFrom` support for series slug renames, preserving access to older series URLs after route changes.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- **Series Routing Defaults**: `series.autoPaths` now defaults to `true`, making `/<series-slug>/<post-slug>` the standard route shape for series posts.
|
|
32
|
+
- **README Positioning**: Updated the English README to match the latest Chinese version, including the project backstory and refreshed documentation structure.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- **Route Conflict Handling**: Prevented auto-path series slugs from colliding with configured `series.customPaths` values during route generation.
|
|
36
|
+
|
|
8
37
|
## [1.12.0] - 2026-03-08
|
|
9
38
|
|
|
10
39
|
### Added
|
package/GEMINI.md
CHANGED
|
@@ -40,15 +40,18 @@ bun test
|
|
|
40
40
|
- `flows/`: Stream-style daily notes or micro-blogging (`[year]/[month]/[day]`).
|
|
41
41
|
- `series/`: Series overview and individual series catalog pages with pagination support.
|
|
42
42
|
- `books/`: Books overview and individual book/chapter pages (`[slug]/[chapter]`).
|
|
43
|
+
- `notes/`: Evergreen notes index and individual note pages with backlinks.
|
|
43
44
|
- `archive/`: Timeline-based chronological archive grouped by year and month.
|
|
44
45
|
- `tags/`: Popularity-sorted tag cloud and filtered listings.
|
|
45
46
|
- `authors/`: Posts filtered by individual authors.
|
|
47
|
+
- `graph/`: Interactive knowledge graph visualization of all connected content.
|
|
46
48
|
- `subscribe/`: Subscription options (RSS, Newsletter, Social).
|
|
47
49
|
- `search.json/`: Static search index generator (supplementary).
|
|
48
50
|
- `src/lib/`: Core logic and utilities.
|
|
49
51
|
- `markdown.ts`: Advanced parsing for posts/series/flows, sorting, and metadata.
|
|
50
52
|
- `search-utils.ts`: Content cleaning and search result processing.
|
|
51
53
|
- `shuffle.ts`: Deterministic and random array shuffling.
|
|
54
|
+
- `urls.ts`: Centralized URL routing and link generation logic.
|
|
52
55
|
- `src/components/`: Modular UI blocks (Hero, HorizontalScroll, Search, CoverImage, ShareBar, etc.).
|
|
53
56
|
- `content/`: Source Markdown/MDX content.
|
|
54
57
|
- `scripts/`: CLI tools for content management and asset processing.
|
|
@@ -57,10 +60,12 @@ bun test
|
|
|
57
60
|
|
|
58
61
|
### Advanced Content Management
|
|
59
62
|
- **Posts**: Supports both flat files (`.mdx`) and nested folders (`/index.mdx`) with co-located assets.
|
|
60
|
-
- **Flows**: Daily notes or micro-posts organized by date (`YYYY/MM/DD`). Designed for quick thoughts and stream-of-consciousness updates.
|
|
63
|
+
- **Flows**: Daily notes or micro-posts organized by date (`YYYY/MM/DD`). Designed for quick thoughts and stream-of-consciousness updates. Supports optional titles via frontmatter or H1 headings.
|
|
61
64
|
- **Series**:
|
|
62
65
|
- Robust grouping with folder-based or file-based entries.
|
|
63
66
|
- Configurable sorting: `date-asc`, `date-desc`, or `manual` (explicit list of slugs).
|
|
67
|
+
- **Collections**: Specialized series (`type: collection`) that allow manual curation of posts and other series.
|
|
68
|
+
- **Namespaced Referencing**: Collection items support `folder/slug` syntax (e.g., `posts/my-post`, `web-dev/intro`) to explicitly resolve posts and prevent collisions across different content directories.
|
|
64
69
|
- Cross-referencing: Series can include posts from the general pool or other folders.
|
|
65
70
|
- Metadata inheritance: Posts can inherit attributes (like authors) from series index files.
|
|
66
71
|
- **Featured Content**: Mark posts or series as `featured` to display them in prominent homepage sections with horizontal scrolling.
|
|
@@ -95,3 +100,6 @@ bun test
|
|
|
95
100
|
- Added pagination to the main posts list and individual series pages.
|
|
96
101
|
- Implemented sophisticated reading time calculation for mixed Latin and CJK text.
|
|
97
102
|
- Enhanced author management with metadata inheritance and slug-based routing.
|
|
103
|
+
- Implemented **Namespaced Collections**: manually curated series now support `folder/slug` references to prevent post collisions and ensure explicit content resolution.
|
|
104
|
+
- Added **Type-Specific Feeds**: dedicated RSS/Atom endpoints for `/posts`, `/flows`, and a global `/all` firehose.
|
|
105
|
+
- Improved **Copy-Paste UX**: wrapped article content in background-stable containers and added `select-none` to UI navigation to ensure clean, high-fidelity content selection.
|
package/README.md
CHANGED
|
@@ -2,22 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [简体中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
**Amytis** is
|
|
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
|

|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Why Amytis?
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -43,6 +58,7 @@ Each stage builds on the previous one, so your garden can evolve naturally.
|
|
|
43
58
|
- Light/Dark mode with automatic system detection.
|
|
44
59
|
- Four color palettes: default (emerald), blue, rose, amber.
|
|
45
60
|
- Responsive layout optimized for reading.
|
|
61
|
+
- Clean Selection: UI elements are non-selectable to ensure high-fidelity copy-pasting of article content.
|
|
46
62
|
- Horizontal scrolling for featured content on the homepage.
|
|
47
63
|
- **Table of Contents:** Sticky TOC with scroll tracking, reading progress indicator, and active heading highlight.
|
|
48
64
|
- **Flexible Content Structure:**
|
|
@@ -55,7 +71,7 @@ Each stage builds on the previous one, so your garden can evolve naturally.
|
|
|
55
71
|
- Fully static export with optimized WebP images.
|
|
56
72
|
- Open Graph and Twitter card metadata for every content type.
|
|
57
73
|
- JSON-LD structured data (`BlogPosting`, `Book`, `Article`) for Google rich results.
|
|
58
|
-
- RSS/Atom feed
|
|
74
|
+
- RSS/Atom feeds including a main curated feed (`feed.xml`), plus type-specific feeds (`/posts/feed.xml`, `/flows/feed.xml`, `/all.xml`). Configurable format (`rss` | `atom` | `both`) and content depth (`full` | `excerpt`).
|
|
59
75
|
- Feed auto-discovery links in `<head>`, native sitemap generation.
|
|
60
76
|
- Multilingual reading time estimate (supports Latin and CJK).
|
|
61
77
|
- **Integrations:**
|
|
@@ -65,14 +81,6 @@ Each stage builds on the previous one, so your garden can evolve naturally.
|
|
|
65
81
|
- **Content CLI Tools:** Create posts, series, and import from PDFs or image folders.
|
|
66
82
|
- **Modern Stack:** Next.js 16, React 19, Tailwind CSS v4, TypeScript 5, Bun.
|
|
67
83
|
|
|
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
84
|
## Quick Start
|
|
77
85
|
|
|
78
86
|
### New Project (Recommended)
|
|
@@ -224,6 +232,7 @@ Create daily notes in `content/flows/YYYY/MM/DD.md` or `.mdx`.
|
|
|
224
232
|
|
|
225
233
|
- CLI: `bun run new-flow` creates today’s entry
|
|
226
234
|
- Chat import: put exports in `imports/chats/` and run `bun run new-flow-from-chat`
|
|
235
|
+
- Optional Title: Set `title` in frontmatter or use an `# Heading` in the content to display a title alongside the date.
|
|
227
236
|
|
|
228
237
|
### Series
|
|
229
238
|
|
package/README.zh.md
CHANGED
|
@@ -2,73 +2,90 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [简体中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
**Amytis**
|
|
5
|
+
**Amytis** 是一个功能强大、设计优雅、交互友好的开源数字花园框架,用于构建知识空间、博客、展示页面或企业知识库等。它基于 Next.js 16、Tailwind CSS v4 和 Bun 构建,强调 Markdown 优先、文本优先,保障作者对内容的长期所有权,在不损失功能和性能的前提下追求极致简洁与优雅。
|
|
6
6
|
|
|
7
7
|
[**在线演示**](https://amytis.vercel.app/)
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## 为什么要做 Amytis ?
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
我写[博客有二十年](https://hutusi.com/archive)了,从最早的博客平台,如 MSN Space (MS Live Space)、新浪博客,到自己搭建 Wordpress、Drupal, 再到 GitHub Pages 推出后全面采用静态博客框架,折腾过 Jekyll、Hugo 及其多个主题,但没有一个框架或主题能让自己真正满意。功能复杂的不够简洁或优雅,简洁优雅的又缺少功能定制。能不能有一款兼顾功能、性能、美观、UX 的博客或知识平台框架呢?这个想法最近几年一直萦绕在我的脑海,实在找不到那就做一个,等到准备付诸实践,才发现难度比想象中的要大得多。
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
+
- 纯净选区: UI 元素不可选中,确保文章内容的高保全复制。
|
|
62
|
+
- 首页精选内容支持横向滚动。
|
|
63
|
+
- **目录:** 吸顶目录支持滚动跟踪、阅读进度指示和当前标题高亮。
|
|
64
|
+
- **灵活的内容结构:**
|
|
65
|
+
- 支持平铺文件(`post.mdx`)或嵌套文件夹(`post/index.mdx`)。
|
|
66
|
+
- 资源可与文章共置: 将图片保存在文章目录内(`./images/`)。
|
|
67
|
+
- 支持带日期前缀的文件名: `2026-01-01-my-post.mdx`。
|
|
68
|
+
- 支持文章、系列、书籍和 Flows 的草稿状态。
|
|
69
|
+
- **作者生态:** 每位作者都有独立主页,包含简介、头像和社交链接。文章可按作者筛选,文末可选显示作者卡片。
|
|
70
|
+
- **性能与 SEO:**
|
|
71
|
+
- 全静态导出,并生成优化后的 WebP 图片。
|
|
72
|
+
- 为所有内容类型生成 Open Graph 和 Twitter Card 元数据。
|
|
73
|
+
- 提供 JSON-LD 结构化数据(`BlogPosting`、`Book`、`Article`),支持 Google 富媒体结果。
|
|
74
|
+
- RSS/Atom 订阅源包含一个主 curated 订阅 (`feed.xml`),以及分类订阅(`/posts/feed.xml`, `/flows/feed.xml`, `/all.xml`)。支持可配置的格式(`rss` | `atom` | `both`)和内容深度(`full` | `excerpt`)。
|
|
75
|
+
- 在 `<head>` 中自动注入 Feed 自动发现链接,并原生生成 sitemap。
|
|
76
|
+
- 多语言阅读时长估算,支持 Latin 和 CJK。
|
|
77
|
+
- **集成能力:**
|
|
78
|
+
- 分析统计: Umami、Plausible 或 Google Analytics。
|
|
79
|
+
- 评论系统: Giscus(GitHub Discussions)或 Disqus。
|
|
80
|
+
- 国际化: 通过本地化的 `site.config.ts` 支持多语言(en、zh)。
|
|
81
|
+
- **内容 CLI 工具:** 支持创建文章、系列,以及从 PDF 或图片文件夹导入内容。
|
|
82
|
+
- **现代技术栈:** Next.js 16、React 19、Tailwind CSS v4、TypeScript 5、Bun。
|
|
66
83
|
|
|
67
84
|
## 快速开始
|
|
68
85
|
|
|
69
86
|
### 新建项目(推荐)
|
|
70
87
|
|
|
71
|
-
|
|
88
|
+
用一条命令创建新的 Amytis 站点:
|
|
72
89
|
|
|
73
90
|
```bash
|
|
74
91
|
bun create amytis my-garden
|
|
@@ -76,30 +93,36 @@ cd my-garden
|
|
|
76
93
|
bun dev
|
|
77
94
|
```
|
|
78
95
|
|
|
79
|
-
|
|
96
|
+
脚手架命令会下载最新打标签发布的 Amytis 版本,安装依赖,并根据你的项目信息更新 `site.config.ts` 和 `package.json`。
|
|
80
97
|
|
|
81
|
-
###
|
|
98
|
+
### 克隆并运行
|
|
99
|
+
|
|
100
|
+
1. **安装依赖:**
|
|
82
101
|
|
|
83
|
-
1. **安装依赖**
|
|
84
102
|
```bash
|
|
85
103
|
bun install
|
|
86
104
|
```
|
|
87
105
|
|
|
88
|
-
2.
|
|
106
|
+
2. **启动开发服务器:**
|
|
107
|
+
|
|
89
108
|
```bash
|
|
90
109
|
bun dev
|
|
91
110
|
```
|
|
92
|
-
打开 [http://localhost:3000](http://localhost:3000)。
|
|
93
111
|
|
|
94
|
-
|
|
112
|
+
访问 [http://localhost:3000](http://localhost:3000)。
|
|
113
|
+
|
|
114
|
+
> **开发环境中的搜索:** Pagefind 索引会在执行 `bun run build:dev` 时生成。本地测试 Cmd/Ctrl+K 前请先运行一次;内容更新后也需要重新生成。
|
|
115
|
+
|
|
116
|
+
3. **生产构建(静态导出):**
|
|
95
117
|
|
|
96
|
-
3. **生产构建(静态导出)**
|
|
97
118
|
```bash
|
|
98
119
|
bun run build
|
|
99
120
|
```
|
|
100
|
-
产物位于 `out/` 目录。
|
|
101
121
|
|
|
102
|
-
|
|
122
|
+
静态站点会生成到 `out/` 目录,并包含优化后的图片资源。
|
|
123
|
+
|
|
124
|
+
4. **开发构建(更快,无图片优化):**
|
|
125
|
+
|
|
103
126
|
```bash
|
|
104
127
|
bun run build:dev
|
|
105
128
|
```
|
|
@@ -117,7 +140,7 @@ bun run validate
|
|
|
117
140
|
bun run build
|
|
118
141
|
bun run build:dev
|
|
119
142
|
bun run clean
|
|
120
|
-
bun run deploy # 部署到 Linux/nginx 服务器(需要 .env.local
|
|
143
|
+
bun run deploy # 部署到 Linux/nginx 服务器(需要 .env.local)
|
|
121
144
|
|
|
122
145
|
## Test
|
|
123
146
|
bun test
|
|
@@ -144,81 +167,138 @@ bun run series-draft "series-slug"
|
|
|
144
167
|
bun run add-series-redirects --dry-run
|
|
145
168
|
```
|
|
146
169
|
|
|
147
|
-
###
|
|
170
|
+
### 将聊天记录导入为 Flows
|
|
148
171
|
|
|
149
|
-
将 `.txt` 或 `.log` 文件放入 `imports/chats
|
|
172
|
+
将 `.txt` 或 `.log` 文件放入 `imports/chats/`,然后执行:
|
|
150
173
|
|
|
151
174
|
```bash
|
|
152
175
|
bun run new-flow-from-chat
|
|
153
176
|
```
|
|
154
177
|
|
|
155
|
-
|
|
156
|
-
|
|
178
|
+
常用参数: `--all`、`--dry-run`、`--author "Name"`、`--append`、`--timestamp`。
|
|
179
|
+
导入历史会记录在 `imports/chats/.imported` 中。
|
|
157
180
|
|
|
158
181
|
## 配置
|
|
159
182
|
|
|
160
|
-
|
|
183
|
+
主要站点配置位于 `site.config.ts`。`site.config.example.ts` 是脚手架所使用的参考模板,查看新选项时很有用:
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
export const siteConfig = {
|
|
187
|
+
// ...
|
|
188
|
+
nav: [
|
|
189
|
+
{ name: "Home", url: "/", weight: 1 },
|
|
190
|
+
{ name: "Flow", url: "/flows", weight: 1.1 }, // 在导航中添加 Flows
|
|
191
|
+
{ name: "Series", url: "/series", weight: 1.5 },
|
|
192
|
+
{ name: "Books", url: "/books", weight: 1.7 },
|
|
193
|
+
{ name: "Archive", url: "/archive", weight: 2 },
|
|
194
|
+
// ...
|
|
195
|
+
],
|
|
196
|
+
// ...
|
|
197
|
+
flows: {
|
|
198
|
+
recentCount: 5,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
```
|
|
161
202
|
|
|
162
|
-
|
|
203
|
+
优先自定义这些高影响配置区块:
|
|
163
204
|
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
205
|
+
- 站点标识: `title`、`description`、`baseUrl`、`ogImage`、`logo`
|
|
206
|
+
- 导航与页脚: `nav`、`footer`、`subscribe`、`social`
|
|
207
|
+
- 内容行为: `posts.basePath`、`posts.includeDateInUrl`、`series.autoPaths`、`series.customPaths`
|
|
208
|
+
- 首页组成: `hero`、`homepage.sections`
|
|
209
|
+
- 集成能力: `analytics`、`comments`、`feed`、`i18n`
|
|
169
210
|
|
|
170
|
-
|
|
211
|
+
如果是通过 nginx 进行静态托管,可以从 `nginx.conf.example` 开始配置。
|
|
171
212
|
|
|
172
213
|
## 静态导出路由规则
|
|
173
214
|
|
|
174
|
-
Amytis 基于 Next.js
|
|
215
|
+
Amytis 基于 Next.js 静态导出构建,关键配置为 `output: "export"` 和 `trailingSlash: true`。
|
|
175
216
|
|
|
176
|
-
- 在 `generateStaticParams()`
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
- 启用 `series.autoPaths`
|
|
180
|
-
-
|
|
181
|
-
-
|
|
217
|
+
- 在 `generateStaticParams()` 中返回原始 segment 值,不要预先用 `encodeURIComponent` 编码。
|
|
218
|
+
- 链接应指向真实 URL,例如 `/posts/中文测试文章`,而不是 `/posts/[slug]` 这样的路由占位符。
|
|
219
|
+
- 文章默认路径为 `/<posts.basePath>/<slug>`,其中 `posts.basePath` 默认值为 `/posts`。
|
|
220
|
+
- 启用 `series.autoPaths` 后,系列文章会移动到 `/<series-slug>/<post-slug>`。
|
|
221
|
+
- 如果配置了 `series.customPaths`,则会以这些自定义前缀覆盖 `autoPaths`。
|
|
222
|
+
- 在把系列文章从默认的 posts 路径迁走之前,先运行 `bun run add-series-redirects --dry-run`,再执行 `bun run add-series-redirects`,以确保旧链接仍然可访问。
|
|
182
223
|
|
|
183
224
|
## 内容写作
|
|
184
225
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
226
|
+
### Posts
|
|
227
|
+
|
|
228
|
+
在 `content/posts/` 中创建 `.md` 或 `.mdx` 文件。
|
|
229
|
+
|
|
230
|
+
- 平铺文件: `content/posts/my-post.mdx`
|
|
231
|
+
- 日期前缀文件: `content/posts/2026-01-01-my-post.mdx`
|
|
232
|
+
- 带共置资源的文件夹文章: `content/posts/my-post/index.mdx`,并配合 `content/posts/my-post/images/*`
|
|
233
|
+
- CLI: `bun run new "Post Title"` 或 `bun run new "Post Title" --folder`
|
|
234
|
+
|
|
235
|
+
### Flows
|
|
236
|
+
|
|
237
|
+
在 `content/flows/YYYY/MM/DD.md` 或 `.mdx` 中创建日记内容。
|
|
238
|
+
|
|
239
|
+
- CLI: `bun run new-flow` 会创建今天的记录
|
|
240
|
+
- 聊天导入: 将导出文件放入 `imports/chats/`,然后运行 `bun run new-flow-from-chat`
|
|
241
|
+
- 可选标题: 在 frontmatter 中设置 `title` 或在内容中使用 `# 标题`,即可在日期旁显示标题。
|
|
242
|
+
|
|
243
|
+
### Series
|
|
244
|
+
|
|
245
|
+
在 `content/series/<slug>/` 下创建目录和 `index.mdx`,然后将系列文章作为同级文件或文件夹加入其中。
|
|
246
|
+
|
|
247
|
+
- CLI: `bun run new-series "Series Name"`
|
|
248
|
+
- 也可以直接将文章创建到已有系列中: `bun run new "Post Title" --series <series-slug>`
|
|
249
|
+
|
|
250
|
+
### Books
|
|
251
|
+
|
|
252
|
+
书籍是位于 `content/books/<slug>/` 下的长篇结构化内容。
|
|
253
|
+
|
|
254
|
+
- 使用 `index.mdx` 保存书籍元数据
|
|
255
|
+
- 在同目录添加章节文件,例如 `introduction.mdx` 或 `setup.mdx`
|
|
256
|
+
- 与书籍相关的工作流可使用 `bun run import-book` 和 `bun run sync-book`
|
|
257
|
+
|
|
258
|
+
### Notes
|
|
259
|
+
|
|
260
|
+
在 `content/notes/` 中创建常青笔记(例如 `concept.mdx`),并使用 `[[wiki-links]]` 将它们连接起来。
|
|
261
|
+
|
|
262
|
+
- CLI: `bun run new-note "Concept"`
|
|
263
|
+
- 在需要时,Notes 和 Posts 都支持有意使用 Unicode slug
|
|
191
264
|
|
|
192
265
|
## 项目结构
|
|
193
266
|
|
|
194
267
|
```text
|
|
195
268
|
amytis/
|
|
196
269
|
content/
|
|
197
|
-
posts/
|
|
198
|
-
series/
|
|
199
|
-
books/
|
|
200
|
-
notes/
|
|
201
|
-
flows/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
270
|
+
posts/ # 博客文章
|
|
271
|
+
series/ # 系列集合
|
|
272
|
+
books/ # 长篇书籍
|
|
273
|
+
notes/ # 数字花园笔记
|
|
274
|
+
flows/ # 日记内容(YYYY/MM/DD)
|
|
275
|
+
about.mdx # 静态页面
|
|
276
|
+
docs/ # 架构、部署、排障文档
|
|
277
|
+
imports/ # 仅本地使用的导入源文件
|
|
278
|
+
public/ # 静态资源
|
|
279
|
+
scripts/ # Bun 编写/构建/导入工具
|
|
206
280
|
src/
|
|
207
|
-
app/
|
|
208
|
-
|
|
281
|
+
app/ # Next.js App Router 页面
|
|
282
|
+
books/ # 书籍路由
|
|
283
|
+
notes/ # 笔记路由
|
|
284
|
+
graph/ # 知识图谱
|
|
285
|
+
flows/ # Flow 路由
|
|
286
|
+
components/ # React 组件
|
|
209
287
|
lib/
|
|
210
|
-
|
|
288
|
+
markdown.ts # 数据访问层
|
|
289
|
+
tests/ # 单元、集成、e2e、工具测试
|
|
211
290
|
packages/
|
|
212
|
-
create-amytis/
|
|
213
|
-
site.config.ts
|
|
291
|
+
create-amytis/ # `bun create amytis` 脚手架 CLI
|
|
292
|
+
site.config.ts # 站点配置
|
|
214
293
|
```
|
|
215
294
|
|
|
216
295
|
## 文档
|
|
217
296
|
|
|
218
|
-
- [
|
|
297
|
+
- [架构总览](docs/ARCHITECTURE.md)
|
|
219
298
|
- [部署指南](docs/deployment.md)
|
|
220
299
|
- [数字花园指南](docs/DIGITAL_GARDEN.md)
|
|
221
300
|
- [贡献指南](docs/CONTRIBUTING.md)
|
|
301
|
+
- [故障排查](docs/TROUBLESHOOTING.md)
|
|
222
302
|
|
|
223
303
|
## 许可证
|
|
224
304
|
|