@hutusi/amytis 1.10.0 → 1.12.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 (130) hide show
  1. package/AGENTS.md +18 -9
  2. package/CHANGELOG.md +40 -0
  3. package/CLAUDE.md +26 -1
  4. package/README.md +78 -7
  5. package/README.zh.md +61 -8
  6. package/TODO.md +6 -4
  7. package/bun.lock +39 -4
  8. package/content/posts/2026-01-12-the-art-of-algorithms.mdx +3 -0
  9. package/content/posts/2026-01-21-kitchen-sink/index.mdx +26 -1
  10. package/content/posts/multimedia-showcase/index.mdx +4 -6
  11. package/content/series/markdown-showcase/syntax-highlighting.mdx +1 -1
  12. package/content/series/modern-web-dev/index.mdx +13 -0
  13. package/content/series/nextjs-deep-dive/01-getting-started.mdx +1 -1
  14. package/docs/ARCHITECTURE.md +3 -0
  15. package/docs/CONTRIBUTING.md +31 -0
  16. package/docs/DIGITAL_GARDEN.md +7 -1
  17. package/docs/TROUBLESHOOTING.md +31 -0
  18. package/eslint.config.mjs +2 -0
  19. package/next.config.ts +8 -2
  20. package/nginx.conf.example +156 -0
  21. package/package.json +17 -5
  22. package/packages/create-amytis/package.json +13 -0
  23. package/packages/create-amytis/src/index.test.ts +187 -0
  24. package/packages/create-amytis/src/index.ts +230 -0
  25. package/packages/create-amytis/tsconfig.json +14 -0
  26. package/playwright.config.ts +199 -0
  27. package/public/images/amytis-screenshot.jpg +0 -0
  28. package/public/images/vibrant-waves.jpg +0 -0
  29. package/public/next-image-export-optimizer-hashes.json +72 -2
  30. package/scripts/add-series-redirects.ts +192 -0
  31. package/scripts/import-obsidian.ts +319 -0
  32. package/site.config.example.ts +29 -3
  33. package/site.config.ts +32 -3
  34. package/src/app/[slug]/[postSlug]/page.tsx +89 -22
  35. package/src/app/[slug]/page.tsx +48 -10
  36. package/src/app/archive/page.tsx +3 -7
  37. package/src/app/books/[slug]/[chapter]/page.tsx +36 -1
  38. package/src/app/books/[slug]/page.tsx +16 -2
  39. package/src/app/books/page.tsx +12 -8
  40. package/src/app/feed.atom/route.ts +62 -0
  41. package/src/app/feed.xml/route.ts +45 -21
  42. package/src/app/flows/[year]/[month]/[day]/page.tsx +14 -0
  43. package/src/app/flows/[year]/page.tsx +1 -1
  44. package/src/app/flows/page/[page]/page.tsx +2 -0
  45. package/src/app/flows/page.tsx +4 -0
  46. package/src/app/globals.css +3 -2
  47. package/src/app/layout.tsx +10 -1
  48. package/src/app/notes/[slug]/page.tsx +32 -9
  49. package/src/app/page.tsx +25 -13
  50. package/src/app/posts/[slug]/page.tsx +66 -10
  51. package/src/app/posts/page/[page]/page.tsx +4 -2
  52. package/src/app/posts/page.tsx +8 -5
  53. package/src/app/series/[slug]/page/[page]/page.tsx +12 -28
  54. package/src/app/series/[slug]/page.tsx +25 -22
  55. package/src/app/series/page.tsx +14 -28
  56. package/src/app/tags/[tag]/page.tsx +7 -2
  57. package/src/app/tags/page.tsx +1 -1
  58. package/src/components/Analytics.tsx +34 -36
  59. package/src/components/AuthorCard.tsx +14 -4
  60. package/src/components/BookMobileNav.tsx +8 -34
  61. package/src/components/BookSidebar.tsx +17 -107
  62. package/src/components/CodeBlock.test.tsx +19 -0
  63. package/src/components/CodeBlock.tsx +20 -16
  64. package/src/components/CoverImage.tsx +3 -1
  65. package/src/components/CuratedSeriesSection.tsx +15 -13
  66. package/src/components/ExternalLinks.tsx +1 -1
  67. package/src/components/FeaturedStoriesSection.tsx +22 -21
  68. package/src/components/FlowCalendarSidebar.tsx +10 -7
  69. package/src/components/FlowContent.tsx +33 -5
  70. package/src/components/Footer.tsx +29 -7
  71. package/src/components/Hero.tsx +2 -2
  72. package/src/components/InlineBookToc.tsx +56 -0
  73. package/src/components/KatexStyles.tsx +8 -0
  74. package/src/components/KnowledgeGraph.tsx +26 -0
  75. package/src/components/LatestWritingSection.tsx +5 -9
  76. package/src/components/MarkdownRenderer.test.tsx +44 -0
  77. package/src/components/MarkdownRenderer.tsx +40 -8
  78. package/src/components/Navbar.tsx +11 -10
  79. package/src/components/NoteSidebar.tsx +6 -76
  80. package/src/components/Pagination.tsx +2 -2
  81. package/src/components/PostList.tsx +77 -61
  82. package/src/components/PostNavigation.tsx +41 -16
  83. package/src/components/PostSidebar.tsx +49 -125
  84. package/src/components/PrevNextNav.tsx +63 -0
  85. package/src/components/RecentNotesSection.tsx +4 -7
  86. package/src/components/RedirectPage.tsx +27 -0
  87. package/src/components/RelatedPosts.tsx +1 -1
  88. package/src/components/RssFeedWidget.tsx +27 -8
  89. package/src/components/SectionLabel.tsx +16 -0
  90. package/src/components/SelectedBooksSection.tsx +5 -4
  91. package/src/components/SeriesCatalog.tsx +78 -71
  92. package/src/components/SeriesList.tsx +45 -55
  93. package/src/components/SeriesSidebar.tsx +2 -1
  94. package/src/components/TagContentTabs.tsx +17 -12
  95. package/src/components/TagPageHeader.tsx +12 -2
  96. package/src/components/TagSidebar.tsx +6 -5
  97. package/src/components/TagsIndexClient.tsx +2 -2
  98. package/src/components/TocPanel.tsx +67 -0
  99. package/src/hooks/useActiveHeading.ts +32 -0
  100. package/src/hooks/useSidebarAutoScroll.ts +19 -0
  101. package/src/i18n/translations.ts +30 -4
  102. package/src/layouts/BookLayout.tsx +21 -40
  103. package/src/layouts/PostLayout.tsx +43 -25
  104. package/src/layouts/SimpleLayout.tsx +15 -3
  105. package/src/lib/comments.test.ts +50 -0
  106. package/src/lib/comments.ts +25 -0
  107. package/src/lib/feed-utils.ts +68 -0
  108. package/src/lib/format-utils.test.ts +27 -0
  109. package/src/lib/format-utils.ts +3 -0
  110. package/src/lib/json-ld.ts +236 -0
  111. package/src/lib/markdown.ts +170 -27
  112. package/src/lib/rehype-image-metadata.test.ts +7 -1
  113. package/src/lib/rehype-image-metadata.ts +10 -0
  114. package/src/lib/remark-wikilinks.test.ts +86 -0
  115. package/src/lib/remark-wikilinks.ts +1 -1
  116. package/src/lib/scroll-utils.ts +11 -0
  117. package/src/lib/shuffle.ts +21 -0
  118. package/src/lib/urls.ts +67 -1
  119. package/tests/e2e/mobile/mobile-compat.spec.ts +407 -0
  120. package/tests/e2e/navigation.test.ts +15 -1
  121. package/tests/integration/books.test.ts +61 -0
  122. package/tests/integration/collections.test.ts +129 -0
  123. package/tests/integration/feed-utils.test.ts +145 -0
  124. package/tests/integration/series.test.ts +9 -0
  125. package/tests/tooling/add-series-redirects.test.ts +110 -0
  126. package/tests/tooling/import-obsidian.test.ts +96 -0
  127. package/tests/unit/static-params.test.ts +132 -4
  128. package/tests/unit/urls.test.ts +30 -0
  129. package/public/images/vibrant-waves.avif +0 -0
  130. /package/public/{screenshot.png → images/screenshot.png} +0 -0
package/AGENTS.md CHANGED
@@ -1,21 +1,27 @@
1
1
  # Repository Guidelines
2
2
 
3
3
  ## Project Structure & Module Organization
4
- - `src/app/`: Next.js App Router pages and route handlers (`posts`, `series`, `tags`, `authors`, feeds, sitemap).
4
+ - `src/app/`: Next.js App Router pages and route handlers (`posts`, `series`, `books`, `flows`, `notes`, `tags`, `authors`, feeds, graph, sitemap, custom `[slug]` routes).
5
5
  - `src/components/`: Reusable UI building blocks (cards, navigation, search, i18n/theme controls).
6
- - `src/lib/`: Content parsing and shared logic (`markdown.ts`, i18n helpers, rehype utilities).
7
- - `content/posts/`, `content/series/`: Markdown/MDX source content. Use folder posts (`index.mdx` + `images/` or `assets/`) when media is co-located.
6
+ - `src/lib/`: Content parsing and shared logic (`markdown.ts`, feed helpers, URL helpers, rehype/remark utilities).
7
+ - `content/`: Markdown/MDX source content for posts, series, books, notes, flows, and static pages. Use folder posts (`index.mdx` + `images/` or `assets/`) when media is co-located.
8
8
  - `tests/`: Integration/e2e/tooling suites; keep focused utility tests near source (example: `src/lib/markdown.test.ts`).
9
- - `scripts/`: Bun-based authoring/import tooling.
9
+ - `scripts/`: Bun-based authoring/import/build tooling.
10
+ - `imports/`: Local-only staging area for chat logs, PDFs, and image folders consumed by import scripts; see `imports/README.md`.
11
+ - `packages/create-amytis/`: The `bun create amytis` scaffold CLI; keep its tests aligned with repo scaffolding behavior.
12
+ - `site.config.ts` is the live site configuration; `site.config.example.ts` is the fuller reference template.
10
13
 
11
14
  ## Build, Test, and Development Commands
12
15
  - `bun install`: Install dependencies.
13
16
  - `bun dev`: Run local dev server at `http://localhost:3000`.
14
- - `bun run build`: Production export build (asset copy + Next build + image optimizer).
15
- - `bun run build:dev`: Build without export image optimization.
16
- - `bun run clean`: Remove generated outputs (`.next`, `out`, `public/posts`).
17
+ - `bun run build`: Production export build (copy assets, generate graph, Next build, optimize images, generate Pagefind index in `out/pagefind`).
18
+ - `bun run build:dev`: Build without export image optimization and generate the dev search index in `public/pagefind`.
19
+ - `bun run build:graph`: Regenerate the knowledge graph data.
20
+ - `bun run validate`: Run the recommended pre-PR validation sequence (`lint`, `test`, `build:dev`).
21
+ - `bun run clean`: Remove generated outputs (`.next`, `out`, `public/posts`, `public/books`, `public/flows`).
17
22
  - `bun run lint`: Run ESLint.
18
- - `bun test` / `bun run test:unit` / `bun run test:int` / `bun run test:e2e`: Run all or scoped tests.
23
+ - `bun test` / `bun run test:unit` / `bun run test:int` / `bun run test:e2e` / `bun run test:mobile`: Run all or scoped tests.
24
+ - Content tooling: `bun run new`, `bun run new-weekly`, `bun run new-series`, `bun run new-note`, `bun run new-flow`, `bun run new-flow-from-chat`, `bun run new-from-pdf`, `bun run new-from-images`, `bun run import-obsidian`, `bun run import-book`, `bun run sync-book`, `bun run series-draft`, `bun run add-series-redirects`.
19
25
 
20
26
  ## Coding Style & Naming Conventions
21
27
  - Use TypeScript for app and utility code; MDX/Markdown for content.
@@ -27,12 +33,15 @@
27
33
  - Project uses `output: "export"` and `trailingSlash: true` in `next.config.ts`.
28
34
  - In `generateStaticParams()`, return raw segment values; do not pre-encode with `encodeURIComponent`.
29
35
  - Never link to route placeholders like `/posts/[slug]`; always link to concrete slugs (for example, `/posts/中文测试文章`).
36
+ - Posts default to `/<posts.basePath>/<slug>`, but may also resolve through `series.autoPaths`, `series.customPaths`, and `[slug]/[postSlug]`; preserve URL helpers instead of hardcoding paths.
37
+ - Before moving series posts away from the default posts path, run `bun run add-series-redirects --dry-run` and then `bun run add-series-redirects` so legacy URLs keep resolving.
30
38
  - When touching dynamic routes, verify both ASCII and Unicode paths.
31
39
 
32
40
  ## Testing Guidelines
33
41
  - Test framework: Bun (`bun:test`). File pattern: `*.test.ts`.
34
- - Add tests when changing slug resolution, content parsing, routing, or scaffolding scripts.
42
+ - Add tests when changing slug resolution, content parsing, routing, feed generation, or scaffolding scripts.
35
43
  - Before PR: run `bun run lint && bun test && bun run build:dev`.
44
+ - Search in local dev depends on the Pagefind output from `bun run build:dev`; regenerate it when changing content or search behavior.
36
45
 
37
46
  ## Commit & Pull Request Guidelines
38
47
  - Follow Conventional Commits used in history (`feat:`, `fix:`, `refactor:`, `docs:`, `release:`).
package/CHANGELOG.md CHANGED
@@ -5,6 +5,46 @@ 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.12.0] - 2026-03-08
9
+
10
+ ### Added
11
+ - **Series Auto Paths**: Added `series.autoPaths` so series posts can be served directly at `/<series-slug>/<post-slug>` without manual per-series path mapping.
12
+ - **URL Migration Tooling**: Added `bun run add-series-redirects` with `--dry-run` and `--auto-paths` support to backfill `redirectFrom` entries before route migrations.
13
+ - **Collections**: Added curated cross-series collections with dedicated data-layer support, listing surfaces, and integration test coverage.
14
+ - **Static Page Comments**: Added per-category comment controls plus optional comments on book chapters, notes, and flows.
15
+ - **Obsidian Importer**: Added `bun run import-obsidian` for recursive vault import with wikilink rewriting and relative-path handling.
16
+ - **Mobile Coverage**: Added Playwright-based mobile compatibility testing and homepage/navigation assertions across real-device profiles.
17
+
18
+ ### Changed
19
+ - **Wikilink Readability**: Wikilinks now prefer rendered note titles over raw slugs where metadata is available.
20
+ - **Homepage Behavior**: Clicking the logo on the homepage now scrolls back to the top, and section spacing stays consistent when optional homepage blocks are disabled.
21
+ - **Documentation**: Refreshed repository guidance, architecture notes, and release-facing docs to match current commands, routing rules, and import workflows.
22
+
23
+ ### Fixed
24
+ - **Redirect Safety**: Prevented `redirectFrom` aliases from hijacking reserved routes or existing pages, including conflicting and single-segment alias cases.
25
+ - **Custom Route Redirects**: Fixed renamed-slug redirects for `series.customPaths` and `[slug]/[postSlug]` routes.
26
+ - **Collection Integrity**: Fixed duplicate collection entries, draft leakage in production, and prev/next navigation inconsistencies.
27
+ - **Tag URL Consistency**: Normalized mixed-case tag URLs without losing display casing and removed duplicate counting from same-document tag variants.
28
+ - **Unicode Note Routing**: Fixed dev-mode handling for percent-encoded Unicode note slugs.
29
+ - **Mobile UX**: Improved narrow-viewport layout stability, tap-target sizing, and flaky mobile test behavior.
30
+
31
+ ## [1.11.0] - 2026-03-07
32
+
33
+ ### Changed
34
+ - **Feed Output Quality**: RSS and Atom feeds now render Markdown content as HTML, include richer item metadata, and send explicit cache headers for static deployments.
35
+ - **Metadata Consistency**: Consolidated image URL resolution so Open Graph and JSON-LD metadata use the same asset handling logic.
36
+ - **Documentation Sync**: Updated the English and Chinese READMEs plus contributor guidance to reflect current scaffolding behavior, dev-search setup, and workspace instructions.
37
+
38
+ ### Fixed
39
+ - **RSS Standards Compliance**: Corrected the RSS MIME type to `application/rss+xml` and improved RSS/Atom structure for better reader compatibility.
40
+ - **Feed Metadata Fidelity**: Improved handling of author fields, item content, and image metadata across feed generation and social preview output.
41
+ - **Post Page Polish**: Improved post page OG images, previous/next navigation consistency, and TOC indentation.
42
+ - **Book Link Consistency**: Standardized book links to use the shared URL helper.
43
+
44
+ ### Docs
45
+ - **Developer Notes**: Added inline documentation for `getFeedItems()` behavior and configuration handling.
46
+ - **Repository Instructions**: Refreshed repository-level agent instructions to match the current workspace layout and release workflow.
47
+
8
48
  ## [1.10.0] - 2026-03-02
9
49
 
10
50
  ### Added
package/CLAUDE.md CHANGED
@@ -18,6 +18,7 @@ bun test # Run all tests
18
18
  bun run test:unit # Run unit tests (src/)
19
19
  bun run test:int # Run integration tests
20
20
  bun run test:e2e # Run end-to-end tests
21
+ bun run test:mobile # Run Playwright mobile compatibility tests (requires dev server)
21
22
  bun test path/to/file.test.ts # Run a single test file
22
23
 
23
24
  # Build
@@ -34,11 +35,18 @@ bun run new-series "Series Name" # Create new series
34
35
  bun run new-from-pdf doc.pdf # Create post from PDF
35
36
  bun run new-from-images ./photos # Create post from image folder
36
37
  bun run new-flow # Create today's flow note
38
+ bun run add-series-redirects # Add redirectFrom to all series posts (for autoPaths migration)
39
+ bun run add-series-redirects <series-slug> # Add redirectFrom to one series only
40
+ bun run add-series-redirects --dry-run # Preview without writing
37
41
  bun run new-flow-from-chat # Import all new files from imports/chats/
38
42
  bun run sync-book # Sync chapters list for all books from disk
39
43
  bun run sync-book <slug> # Sync chapters list for one book
40
44
  ```
41
45
 
46
+ ## Design Principles
47
+
48
+ - **Strict build over silent runtime failure.** This is a statically exported site — all misconfiguration must be caught at build time. Prefer `throw` in `generateStaticParams` and similar build-time functions over silent skips or `console.warn`. Examples: `validateSeriesAutoPaths` throws on slug collisions; `redirectFrom` alias conflicts should throw rather than silently producing broken redirects.
49
+
42
50
  ## Architecture
43
51
 
44
52
  ### Data Flow
@@ -96,6 +104,15 @@ bun run sync-book <slug> # Sync chapters list for one book
96
104
 
97
105
  Date-prefixed filenames (`2026-01-01-my-post.mdx`) extract dates automatically.
98
106
 
107
+ ## Config Files
108
+
109
+ There are two config files that must be kept in sync:
110
+
111
+ - **`site.config.ts`** — the live config for this repo (i18n enabled; locale-aware fields use `{ en: '...', zh: '...' }` objects)
112
+ - **`site.config.example.ts`** — single-language starter template shipped via `create-amytis`; locale-aware fields use plain strings; optional features (books, flow) default to disabled
113
+
114
+ **Rule:** Any schema change to `site.config.ts` (new field, renamed field, type change) must be mirrored in `site.config.example.ts`. Locale-aware values (`string | Record<string, string>`) should use plain strings in the example.
115
+
99
116
  ## Configuration (`site.config.ts`)
100
117
 
101
118
  Key configuration options:
@@ -109,8 +126,12 @@ Key configuration options:
109
126
  - `i18n` - Default locale and supported locales
110
127
  - `featured.series` - Scrollable series: `scrollThreshold` (default: 2), `maxItems` (default: 6)
111
128
  - `featured.stories` - Scrollable stories: `scrollThreshold` (default: 1), `maxItems` (default: 5)
112
- - `analytics.provider` - 'umami' | 'plausible' | 'google' | null
129
+ - `analytics.providers` - array of enabled providers: `['umami', 'google']`; `[]` disables analytics
113
130
  - `comments.provider` - 'giscus' | 'disqus' | null
131
+ - `feed.format` - 'rss' | 'atom' | 'both'
132
+ - `feed.content` - 'full' | 'excerpt'
133
+ - `feed.maxItems` - max feed items (0 = unlimited)
134
+ - `footer.bottomLinks` - custom links in the footer bottom bar (ICP, cookie policy, etc.); `text` accepts plain string or `{ en, zh }` locale map
114
135
  - `posts.basePath` - Custom URL prefix for all posts (default: `'posts'`); e.g. `'articles'` → posts at `/articles/[slug]`
115
136
  - `posts.authors.default` - Fallback authors when a post has none set in frontmatter
116
137
  - `posts.authors.showInHeader` - Show author byline below post title (default: true)
@@ -125,6 +146,7 @@ Key configuration options:
125
146
  ```yaml
126
147
  ---
127
148
  title: "Post Title"
149
+ subtitle: "Optional subtitle line" # Rendered below the title in italic
128
150
  date: "2026-01-01"
129
151
  excerpt: "Optional summary (auto-generated if omitted)"
130
152
  category: "Category Name"
@@ -143,6 +165,9 @@ externalLinks: # Links to external discussions
143
165
  url: "https://news.ycombinator.com/item?id=12345"
144
166
  - name: "V2EX"
145
167
  url: "https://v2ex.com/t/123456"
168
+ redirectFrom: # Old URLs that should redirect to this post (prefix changes only)
169
+ - /posts/my-old-slug
170
+ - /old-series/my-old-slug
146
171
  ---
147
172
  ```
148
173
 
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [**Live Demo**](https://amytis.vercel.app/)
8
8
 
9
- ![Amytis Screenshot](public/screenshot.png)
9
+ ![Amytis Screenshot](public/images/amytis-screenshot.jpg)
10
10
 
11
11
  ## The Knowledge Ladder
12
12
 
@@ -50,9 +50,13 @@ Each stage builds on the previous one, so your garden can evolve naturally.
50
50
  - Co-located assets: keep images inside post folders (`./images/`).
51
51
  - Date-prefixed filenames: `2026-01-01-my-post.mdx`.
52
52
  - Draft support for posts, series, books, and flows.
53
+ - **Author Ecosystem:** Per-author profile pages with bio, avatar, and social links. Posts are filterable by author; an optional author card appears at the end of each post.
53
54
  - **Performance & SEO:**
54
55
  - Fully static export with optimized WebP images.
55
- - Native sitemap and RSS feed generation.
56
+ - Open Graph and Twitter card metadata for every content type.
57
+ - JSON-LD structured data (`BlogPosting`, `Book`, `Article`) for Google rich results.
58
+ - RSS/Atom feed with configurable format (`rss` | `atom` | `both`) and content depth (`full` | `excerpt`).
59
+ - Feed auto-discovery links in `<head>`, native sitemap generation.
56
60
  - Multilingual reading time estimate (supports Latin and CJK).
57
61
  - **Integrations:**
58
62
  - Analytics: Umami, Plausible, or Google Analytics.
@@ -71,6 +75,20 @@ Each stage builds on the previous one, so your garden can evolve naturally.
71
75
 
72
76
  ## Quick Start
73
77
 
78
+ ### New Project (Recommended)
79
+
80
+ Scaffold a new Amytis site with one command:
81
+
82
+ ```bash
83
+ bun create amytis my-garden
84
+ cd my-garden
85
+ bun dev
86
+ ```
87
+
88
+ The scaffold command downloads the latest tagged Amytis release, installs dependencies, and patches `site.config.ts` and `package.json` with your project metadata.
89
+
90
+ ### Clone & Run
91
+
74
92
  1. **Install Dependencies:**
75
93
  ```bash
76
94
  bun install
@@ -82,6 +100,8 @@ Each stage builds on the previous one, so your garden can evolve naturally.
82
100
  ```
83
101
  Visit [http://localhost:3000](http://localhost:3000).
84
102
 
103
+ > **Search in dev:** the Pagefind index is generated during `bun run build:dev`. Run it once before testing Cmd/Ctrl+K locally, and re-run it after content changes.
104
+
85
105
  3. **Build for Production (Static Export):**
86
106
  ```bash
87
107
  bun run build
@@ -99,6 +119,7 @@ Each stage builds on the previous one, so your garden can evolve naturally.
99
119
  ## Core
100
120
  bun dev
101
121
  bun run lint
122
+ bun run build:graph
102
123
  bun run validate
103
124
 
104
125
  ## Build & Deploy
@@ -112,9 +133,11 @@ bun test
112
133
  bun run test:unit
113
134
  bun run test:int
114
135
  bun run test:e2e
136
+ bun run test:mobile
115
137
 
116
138
  ## Create Content
117
139
  bun run new "Post Title"
140
+ bun run new-weekly "Weekly Topic"
118
141
  bun run new-series "Series Name"
119
142
  bun run new-note "Concept"
120
143
  bun run new-flow
@@ -123,9 +146,11 @@ bun run new-flow
123
146
  bun run new-from-pdf ./doc.pdf
124
147
  bun run new-from-images ./photos
125
148
  bun run new-flow-from-chat
149
+ bun run import-obsidian
126
150
  bun run import-book
127
151
  bun run sync-book
128
152
  bun run series-draft "series-slug"
153
+ bun run add-series-redirects --dry-run
129
154
  ```
130
155
 
131
156
  ### Importing Chat Logs to Flows
@@ -141,7 +166,7 @@ Import history is stored in `imports/chats/.imported`.
141
166
 
142
167
  ## Configuration
143
168
 
144
- All site settings are managed in `site.config.ts`:
169
+ Primary site settings live in `site.config.ts`. `site.config.example.ts` is the reference template used by the scaffold and is useful when reviewing new options:
145
170
 
146
171
  ```typescript
147
172
  export const siteConfig = {
@@ -161,27 +186,66 @@ export const siteConfig = {
161
186
  };
162
187
  ```
163
188
 
189
+ High-impact areas to customize first:
190
+
191
+ - Site identity: `title`, `description`, `baseUrl`, `ogImage`, `logo`
192
+ - Navigation and footer: `nav`, `footer`, `subscribe`, `social`
193
+ - Content behavior: `posts.basePath`, `posts.includeDateInUrl`, `series.autoPaths`, `series.customPaths`
194
+ - Homepage composition: `hero`, `homepage.sections`
195
+ - Integrations: `analytics`, `comments`, `feed`, `i18n`
196
+
197
+ For static hosting behind nginx, start from `nginx.conf.example`.
198
+
199
+ ## Static Export Routing Rules
200
+
201
+ Amytis is built around Next.js static export with `output: "export"` and `trailingSlash: true`.
202
+
203
+ - In `generateStaticParams()`, return raw segment values. Do not pre-encode with `encodeURIComponent`.
204
+ - Link to concrete URLs such as `/posts/中文测试文章`, not route placeholders like `/posts/[slug]`.
205
+ - Posts default to `/<posts.basePath>/<slug>` and `posts.basePath` defaults to `/posts`.
206
+ - If `series.autoPaths` is enabled, series posts move to `/<series-slug>/<post-slug>`.
207
+ - If `series.customPaths` is configured, those custom prefixes override `autoPaths`.
208
+ - Before moving series posts off the default posts path, run `bun run add-series-redirects --dry-run` and then `bun run add-series-redirects` so legacy URLs still resolve.
209
+
164
210
  ## Writing Content
165
211
 
166
212
  ### Posts
167
213
 
168
214
  Create `.md` or `.mdx` files in `content/posts/`.
169
215
 
216
+ - Flat file: `content/posts/my-post.mdx`
217
+ - Date-prefixed file: `content/posts/2026-01-01-my-post.mdx`
218
+ - Folder post with co-located media: `content/posts/my-post/index.mdx` plus `content/posts/my-post/images/*`
219
+ - CLI: `bun run new "Post Title"` or `bun run new "Post Title" --folder`
220
+
170
221
  ### Flows
171
222
 
172
- Create daily notes in `content/flows/YYYY/MM/DD.mdx` or `content/flows/YYYY/MM/DD/index.mdx`.
223
+ Create daily notes in `content/flows/YYYY/MM/DD.md` or `.mdx`.
224
+
225
+ - CLI: `bun run new-flow` creates today’s entry
226
+ - Chat import: put exports in `imports/chats/` and run `bun run new-flow-from-chat`
173
227
 
174
228
  ### Series
175
229
 
176
- Create a directory in `content/series/` with an `index.mdx`.
230
+ Create a directory in `content/series/<slug>/` with an `index.mdx`, then add posts as sibling files or folders.
231
+
232
+ - CLI: `bun run new-series "Series Name"`
233
+ - You can also create a post directly inside an existing series with `bun run new "Post Title" --series <series-slug>`
177
234
 
178
235
  ### Books
179
236
 
180
- Books are for long-form, structured content. Create a directory in `content/books/`.
237
+ Books are long-form structured content under `content/books/<slug>/`.
238
+
239
+ - Keep book metadata in `index.mdx`
240
+ - Add chapter files beside it, for example `introduction.mdx` or `setup.mdx`
241
+ - Use `bun run import-book` and `bun run sync-book` for book-oriented workflows
181
242
 
182
243
  ### Notes
183
244
 
184
- Create evergreen notes in `content/notes/` (e.g., `concept.mdx`). Use `[[wiki-links]]` to connect them.
245
+ Create evergreen notes in `content/notes/` (for example `concept.mdx`). Use `[[wiki-links]]` to connect them.
246
+
247
+ - CLI: `bun run new-note "Concept"`
248
+ - Unicode slugs are supported intentionally for notes and posts where needed
185
249
 
186
250
  ## Project Structure
187
251
 
@@ -194,7 +258,10 @@ amytis/
194
258
  notes/ # Digital garden notes
195
259
  flows/ # Daily notes (YYYY/MM/DD)
196
260
  about.mdx # Static pages
261
+ docs/ # Architecture, deployment, troubleshooting
262
+ imports/ # Local-only input files for import scripts
197
263
  public/ # Static assets
264
+ scripts/ # Bun authoring/build/import tooling
198
265
  src/
199
266
  app/ # Next.js App Router pages
200
267
  books/ # Book routes
@@ -204,6 +271,9 @@ amytis/
204
271
  components/ # React components
205
272
  lib/
206
273
  markdown.ts # Data access layer
274
+ tests/ # Unit, integration, e2e, tooling tests
275
+ packages/
276
+ create-amytis/ # `bun create amytis` scaffold CLI
207
277
  site.config.ts # Site configuration
208
278
  ```
209
279
 
@@ -213,6 +283,7 @@ amytis/
213
283
  - [Deployment Guide](docs/deployment.md)
214
284
  - [Digital Garden Guide](docs/DIGITAL_GARDEN.md)
215
285
  - [Contributing Guide](docs/CONTRIBUTING.md)
286
+ - [Troubleshooting](docs/TROUBLESHOOTING.md)
216
287
 
217
288
  ## License
218
289
 
package/README.zh.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [**在线演示**](https://amytis.vercel.app/)
8
8
 
9
- ![Amytis 截图](public/screenshot.png)
9
+ ![Amytis 截图](public/images/amytis-screenshot.jpg)
10
10
 
11
11
  ## 知识阶梯
12
12
 
@@ -43,9 +43,13 @@ Amytis 围绕一条从粗糙到精炼的知识路径构建:
43
43
  - 自动系统主题检测(明/暗)
44
44
  - 四套配色主题:default、blue、rose、amber
45
45
  - 吸顶目录与阅读进度跟踪
46
+ - **作者生态**:每位作者有独立主页,包含简介、头像与社交链接。文章支持按作者筛选,并可在文末显示作者卡片。
46
47
  - **性能与 SEO**:
47
48
  - 全静态导出与 WebP 优化
48
- - 自动 sitemapRSS
49
+ - 每种内容类型均有完整的 Open Graph Twitter Card 元数据
50
+ - JSON-LD 结构化数据(`BlogPosting`、`Book`、`Article`),支持 Google 富媒体搜索结果
51
+ - RSS/Atom 订阅源,格式(`rss` | `atom` | `both`)与内容深度(`full` | `excerpt`)可配置
52
+ - `<head>` 自动注入 Feed 发现链接,原生 sitemap 生成
49
53
  - 支持 Latin/CJK 的多语言阅读时长估算
50
54
  - **集成能力**:
51
55
  - 统计:Umami / Plausible / Google Analytics
@@ -62,6 +66,20 @@ Amytis 围绕一条从粗糙到精炼的知识路径构建:
62
66
 
63
67
  ## 快速开始
64
68
 
69
+ ### 新建项目(推荐)
70
+
71
+ 一条命令创建新的 Amytis 站点:
72
+
73
+ ```bash
74
+ bun create amytis my-garden
75
+ cd my-garden
76
+ bun dev
77
+ ```
78
+
79
+ 该脚手架会下载最新发布版 Amytis,自动安装依赖,并根据你的项目信息更新 `site.config.ts` 和 `package.json`。
80
+
81
+ ### 克隆运行
82
+
65
83
  1. **安装依赖**
66
84
  ```bash
67
85
  bun install
@@ -73,6 +91,8 @@ Amytis 围绕一条从粗糙到精炼的知识路径构建:
73
91
  ```
74
92
  打开 [http://localhost:3000](http://localhost:3000)。
75
93
 
94
+ > **本地搜索说明:** Pagefind 索引是在执行 `bun run build:dev` 时生成的。本地测试 Cmd/Ctrl+K 前先运行一次;内容更新后也需要重新生成。
95
+
76
96
  3. **生产构建(静态导出)**
77
97
  ```bash
78
98
  bun run build
@@ -90,6 +110,7 @@ Amytis 围绕一条从粗糙到精炼的知识路径构建:
90
110
  ## Core
91
111
  bun dev
92
112
  bun run lint
113
+ bun run build:graph
93
114
  bun run validate
94
115
 
95
116
  ## Build & Deploy
@@ -103,9 +124,11 @@ bun test
103
124
  bun run test:unit
104
125
  bun run test:int
105
126
  bun run test:e2e
127
+ bun run test:mobile
106
128
 
107
129
  ## Create Content
108
130
  bun run new "Post Title"
131
+ bun run new-weekly "Weekly Topic"
109
132
  bun run new-series "Series Name"
110
133
  bun run new-note "Concept"
111
134
  bun run new-flow
@@ -114,9 +137,11 @@ bun run new-flow
114
137
  bun run new-from-pdf ./doc.pdf
115
138
  bun run new-from-images ./photos
116
139
  bun run new-flow-from-chat
140
+ bun run import-obsidian
117
141
  bun run import-book
118
142
  bun run sync-book
119
143
  bun run series-draft "series-slug"
144
+ bun run add-series-redirects --dry-run
120
145
  ```
121
146
 
122
147
  ### 导入聊天记录到 Flows
@@ -132,15 +157,37 @@ bun run new-flow-from-chat
132
157
 
133
158
  ## 配置
134
159
 
135
- 所有站点配置集中在 `site.config.ts`。
160
+ 主要站点配置集中在 `site.config.ts`,`site.config.example.ts` 则是更完整的参考模板,适合查看可选项和默认写法。
161
+
162
+ 优先关注这些配置区块:
163
+
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`
169
+
170
+ 如果你部署到 nginx,可直接从 `nginx.conf.example` 开始调整。
171
+
172
+ ## 静态导出路由规则
173
+
174
+ Amytis 基于 Next.js 静态导出,核心约束是 `output: "export"` 和 `trailingSlash: true`。
175
+
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`
136
182
 
137
183
  ## 内容写作
138
184
 
139
- - **Posts**:创建到 `content/posts/`
140
- - **Flows**:创建到 `content/flows/YYYY/MM/DD.mdx`(或文件夹模式)
141
- - **Series**:创建 `content/series/<slug>/index.mdx`
142
- - **Books**:创建到 `content/books/<slug>/`
143
- - **Notes**:创建到 `content/notes/`,支持 `[[wiki-links]]`
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 路径
144
191
 
145
192
  ## 项目结构
146
193
 
@@ -152,11 +199,17 @@ amytis/
152
199
  books/
153
200
  notes/
154
201
  flows/
202
+ docs/
203
+ imports/
155
204
  public/
205
+ scripts/
156
206
  src/
157
207
  app/
158
208
  components/
159
209
  lib/
210
+ tests/
211
+ packages/
212
+ create-amytis/
160
213
  site.config.ts
161
214
  ```
162
215
 
package/TODO.md CHANGED
@@ -1,18 +1,19 @@
1
1
  # Amytis Roadmap
2
2
 
3
3
  ## 🚀 Priority UX & Engineering
4
- - [ ] **Image Zoom**: Implement medium-zoom or a lightbox for MDX images.
5
4
  - [ ] **Breadcrumbs**: Extend Flow breadcrumbs to standard Posts and Books.
6
5
  - [ ] **Dynamic OG**: Generate automated social cards with Satori for every post.
7
6
  - [ ] **PWA Support**: Add manifest and service worker for offline reading.
8
- - [ ] **SEO Boost**: Implement JSON-LD structured data for Articles, Books, and Breadcrumbs.
7
+ - [ ] **Image Zoom**: Implement medium-zoom or a lightbox for MDX images.
9
8
 
10
9
  ## 🌿 Digital Garden Evolution
11
- - [ ] **Knowledge Graph**:
10
+ - [ ] **Knowledge Graph**:
12
11
  - [ ] Interactive fullscreen mode for the graph.
13
12
  - [ ] Filter graph by tags or content types.
14
13
  - [ ] "Local Graph" view in the sidebar of individual notes.
15
- - [ ] **Discovery**:
14
+ - [ ] **Hover Preview**: Show a floating excerpt card when hovering over wiki-links, without navigating away.
15
+ - [ ] **Transclusion**: Embed another note or post's content inline using `![[slug]]` syntax.
16
+ - [ ] **Discovery**:
16
17
  - [ ] "On this day" section for Flows (history from previous years).
17
18
  - [ ] RSS/Atom feeds for specific categories or tags.
18
19
  - [ ] **Notes**: Support for un-linked mentions (searching for note titles in plain text).
@@ -23,6 +24,7 @@
23
24
  - [ ] **Optimization**: Automatically compress and resize co-located images during build.
24
25
 
25
26
  ## ✅ Completed Highlights
27
+ - [x] **JSON-LD Structured Data**: `BlogPosting`, `Book`, and `Article` schemas for Google rich results.
26
28
  - [x] **Digital Garden**: Notes, Wiki-links, Backlinks, and interactive Knowledge Graph.
27
29
  - [x] **Pagefind Search**: High-performance static full-text indexing with rich UI.
28
30
  - [x] **Smart Navigation**: Persistent "Previous" and "Next" article links on all posts.