@hutusi/amytis 1.9.0 → 1.11.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/.entire/settings.json +4 -0
- package/AGENTS.md +13 -7
- package/CHANGELOG.md +41 -0
- package/CLAUDE.md +30 -2
- package/README.md +84 -58
- package/README.zh.md +195 -0
- package/TODO.md +6 -4
- package/bun.lock +30 -4
- package/content/books/sample-book/images/digital-garden.svg +25 -0
- package/content/books/sample-book/index.mdx +1 -1
- package/content/books/sample-book/introduction.mdx +2 -0
- package/content/posts/2026-01-21-kitchen-sink/index.mdx +26 -1
- package/content/posts/legacy-markdown.md +0 -2
- package/content/posts/markdown-features.mdx +1 -1
- package/content/posts/multilingual-test.mdx +0 -1
- package/content/posts/syntax-highlighting-showcase.mdx +1 -0
- package/content/posts/understanding-react-hooks.mdx +1 -0
- package/content/series/ai-nexus-weekly/index.mdx +1 -1
- package/content/series/digital-garden/01-philosophy.mdx +2 -0
- package/content/series/digital-garden/index.mdx +1 -1
- package/content/series/markdown-showcase/index.mdx +1 -1
- package/content/series/markdown-showcase/syntax-highlighting.mdx +2 -0
- package/content/series/nextjs-deep-dive/01-getting-started.mdx +2 -1
- package/content/series/nextjs-deep-dive/index.mdx +1 -1
- package/content/subscribe.mdx +27 -0
- package/docs/ARCHITECTURE.md +85 -105
- package/docs/CONTRIBUTING.md +11 -3
- package/docs/DIGITAL_GARDEN.md +11 -9
- package/docs/deployment.md +31 -13
- package/eslint.config.mjs +2 -0
- package/package.json +13 -4
- package/packages/create-amytis/package.json +13 -0
- package/packages/create-amytis/src/index.test.ts +187 -0
- package/packages/create-amytis/src/index.ts +230 -0
- package/packages/create-amytis/tsconfig.json +14 -0
- package/public/images/amytis-screenshot.jpg +0 -0
- package/public/images/antelope-canyon.jpg +0 -0
- package/public/images/avatar.jpg +0 -0
- package/public/images/cappadocia.jpg +0 -0
- package/public/images/flowers.jpg +0 -0
- package/public/images/galaxy.jpg +0 -0
- package/public/images/lake.jpg +0 -0
- package/public/images/mountains.jpg +0 -0
- package/public/images/vibrant-waves.avif +0 -0
- package/public/images/wechat-qr.jpg +0 -0
- package/public/next-image-export-optimizer-hashes.json +72 -2
- package/scripts/deploy.ts +77 -0
- package/site.config.example.ts +268 -0
- package/site.config.ts +82 -10
- package/src/app/[slug]/[postSlug]/page.tsx +161 -0
- package/src/app/[slug]/page/[page]/page.tsx +202 -0
- package/src/app/[slug]/page.tsx +162 -7
- package/src/app/archive/page.tsx +5 -8
- package/src/app/books/[slug]/[chapter]/page.tsx +45 -3
- package/src/app/books/[slug]/page.tsx +16 -2
- package/src/app/books/page.tsx +12 -8
- package/src/app/feed.atom/route.ts +62 -0
- package/src/app/feed.xml/route.ts +45 -20
- package/src/app/flows/[year]/[month]/[day]/page.tsx +9 -1
- package/src/app/flows/[year]/page.tsx +1 -1
- package/src/app/flows/page/[page]/page.tsx +2 -0
- package/src/app/flows/page.tsx +4 -0
- package/src/app/globals.css +9 -3
- package/src/app/layout.tsx +22 -1
- package/src/app/notes/[slug]/page.tsx +2 -3
- package/src/app/page.tsx +86 -8
- package/src/app/posts/[slug]/page.tsx +33 -7
- package/src/app/posts/page/[page]/page.tsx +9 -5
- package/src/app/posts/page.tsx +13 -7
- package/src/app/series/[slug]/page/[page]/page.tsx +8 -25
- package/src/app/series/[slug]/page.tsx +21 -19
- package/src/app/series/page.tsx +14 -28
- package/src/app/sitemap.ts +2 -1
- package/src/app/tags/[tag]/page.tsx +1 -1
- package/src/app/tags/page.tsx +1 -1
- package/src/components/Analytics.tsx +34 -36
- package/src/components/AuthorCard.tsx +56 -14
- package/src/components/BookMobileNav.tsx +8 -34
- package/src/components/BookSidebar.tsx +17 -107
- package/src/components/CodeBlock.test.tsx +19 -0
- package/src/components/CodeBlock.tsx +20 -16
- package/src/components/Comments.tsx +4 -3
- package/src/components/CoverImage.tsx +11 -3
- package/src/components/CuratedSeriesSection.tsx +17 -15
- package/src/components/ExternalLinks.tsx +1 -1
- package/src/components/FeaturedStoriesSection.tsx +124 -58
- package/src/components/FlowCalendarSidebar.tsx +10 -7
- package/src/components/FlowContent.tsx +33 -5
- package/src/components/Footer.tsx +28 -6
- package/src/components/Hero.tsx +44 -92
- package/src/components/InlineBookToc.tsx +56 -0
- package/src/components/KnowledgeGraph.tsx +26 -0
- package/src/components/LanguageProvider.tsx +7 -2
- package/src/components/LanguageSwitch.tsx +1 -1
- package/src/components/LatestWritingSection.tsx +12 -22
- package/src/components/MarkdownRenderer.test.tsx +41 -0
- package/src/components/MarkdownRenderer.tsx +43 -8
- package/src/components/Navbar.tsx +24 -15
- package/src/components/NoteSidebar.tsx +6 -76
- package/src/components/Pagination.tsx +2 -2
- package/src/components/PostCard.tsx +2 -1
- package/src/components/PostList.tsx +81 -62
- package/src/components/PostNavigation.tsx +8 -7
- package/src/components/PostSidebar.tsx +12 -107
- package/src/components/PrevNextNav.tsx +63 -0
- package/src/components/RecentNotesSection.tsx +2 -2
- package/src/components/RelatedPosts.tsx +3 -2
- package/src/components/RssFeedWidget.tsx +55 -0
- package/src/components/SectionLabel.tsx +16 -0
- package/src/components/SelectedBooksSection.tsx +12 -15
- package/src/components/SeriesCatalog.tsx +74 -69
- package/src/components/SeriesList.tsx +11 -36
- package/src/components/SeriesSidebar.tsx +4 -2
- package/src/components/TagContentTabs.tsx +17 -12
- package/src/components/TagPageHeader.tsx +12 -2
- package/src/components/TagSidebar.tsx +3 -2
- package/src/components/TagsIndexClient.tsx +1 -1
- package/src/components/TocPanel.tsx +67 -0
- package/src/hooks/useActiveHeading.ts +32 -0
- package/src/hooks/useSidebarAutoScroll.ts +19 -0
- package/src/i18n/translations.ts +26 -4
- package/src/layouts/BookLayout.tsx +10 -40
- package/src/layouts/PostLayout.tsx +37 -26
- package/src/layouts/SimpleLayout.tsx +5 -5
- package/src/lib/feed-utils.ts +68 -0
- package/src/lib/format-utils.test.ts +27 -0
- package/src/lib/format-utils.ts +3 -0
- package/src/lib/image-utils.ts +12 -0
- package/src/lib/json-ld.ts +236 -0
- package/src/lib/markdown.ts +62 -7
- package/src/lib/rehype-image-metadata.test.ts +124 -0
- package/src/lib/rehype-image-metadata.ts +21 -5
- package/src/lib/scroll-utils.ts +11 -0
- package/src/lib/shuffle.ts +21 -0
- package/src/lib/urls.ts +51 -0
- package/tests/e2e/navigation.test.ts +15 -1
- package/tests/integration/books.test.ts +61 -0
- package/tests/integration/feed-utils.test.ts +145 -0
- package/tests/integration/series.test.ts +9 -0
- package/tests/unit/static-params.test.ts +59 -2
- package/src/app/subscribe/page.tsx +0 -17
- package/src/components/SubscribePage.tsx +0 -298
- /package/public/{screenshot.png → images/screenshot.png} +0 -0
package/AGENTS.md
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
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`,
|
|
7
|
-
- `content
|
|
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
9
|
- `scripts/`: Bun-based authoring/import tooling.
|
|
10
|
+
- `packages/create-amytis/`: The `bun create amytis` scaffold CLI; keep its tests aligned with repo scaffolding behavior.
|
|
10
11
|
|
|
11
12
|
## Build, Test, and Development Commands
|
|
12
13
|
- `bun install`: Install dependencies.
|
|
13
14
|
- `bun dev`: Run local dev server at `http://localhost:3000`.
|
|
14
|
-
- `bun run build`: Production export build (
|
|
15
|
-
- `bun run build:dev`: Build without export image optimization
|
|
16
|
-
- `bun run
|
|
15
|
+
- `bun run build`: Production export build (copy assets, generate graph, Next build, optimize images, generate Pagefind index in `out/pagefind`).
|
|
16
|
+
- `bun run build:dev`: Build without export image optimization and generate the dev search index in `public/pagefind`.
|
|
17
|
+
- `bun run build:graph`: Regenerate the knowledge graph data.
|
|
18
|
+
- `bun run validate`: Run the recommended pre-PR validation sequence (`lint`, `test`, `build:dev`).
|
|
19
|
+
- `bun run clean`: Remove generated outputs (`.next`, `out`, `public/posts`, `public/books`, `public/flows`).
|
|
17
20
|
- `bun run lint`: Run ESLint.
|
|
18
21
|
- `bun test` / `bun run test:unit` / `bun run test:int` / `bun run test:e2e`: Run all or scoped tests.
|
|
22
|
+
- 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-book`, `bun run sync-book`, `bun run series-draft`.
|
|
19
23
|
|
|
20
24
|
## Coding Style & Naming Conventions
|
|
21
25
|
- Use TypeScript for app and utility code; MDX/Markdown for content.
|
|
@@ -27,12 +31,14 @@
|
|
|
27
31
|
- Project uses `output: "export"` and `trailingSlash: true` in `next.config.ts`.
|
|
28
32
|
- In `generateStaticParams()`, return raw segment values; do not pre-encode with `encodeURIComponent`.
|
|
29
33
|
- Never link to route placeholders like `/posts/[slug]`; always link to concrete slugs (for example, `/posts/中文测试文章`).
|
|
34
|
+
- Posts may also resolve through custom top-level paths via `series.customPaths` and `[slug]/[postSlug]`; preserve those URL helpers instead of hardcoding paths.
|
|
30
35
|
- When touching dynamic routes, verify both ASCII and Unicode paths.
|
|
31
36
|
|
|
32
37
|
## Testing Guidelines
|
|
33
38
|
- Test framework: Bun (`bun:test`). File pattern: `*.test.ts`.
|
|
34
|
-
- Add tests when changing slug resolution, content parsing, routing, or scaffolding scripts.
|
|
39
|
+
- Add tests when changing slug resolution, content parsing, routing, feed generation, or scaffolding scripts.
|
|
35
40
|
- Before PR: run `bun run lint && bun test && bun run build:dev`.
|
|
41
|
+
- Search in local dev depends on the Pagefind output from `bun run build:dev`; regenerate it when changing content or search behavior.
|
|
36
42
|
|
|
37
43
|
## Commit & Pull Request Guidelines
|
|
38
44
|
- Follow Conventional Commits used in history (`feat:`, `fix:`, `refactor:`, `docs:`, `release:`).
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@ 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.11.0] - 2026-03-07
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **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.
|
|
12
|
+
- **Metadata Consistency**: Consolidated image URL resolution so Open Graph and JSON-LD metadata use the same asset handling logic.
|
|
13
|
+
- **Documentation Sync**: Updated the English and Chinese READMEs plus contributor guidance to reflect current scaffolding behavior, dev-search setup, and workspace instructions.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **RSS Standards Compliance**: Corrected the RSS MIME type to `application/rss+xml` and improved RSS/Atom structure for better reader compatibility.
|
|
17
|
+
- **Feed Metadata Fidelity**: Improved handling of author fields, item content, and image metadata across feed generation and social preview output.
|
|
18
|
+
- **Post Page Polish**: Improved post page OG images, previous/next navigation consistency, and TOC indentation.
|
|
19
|
+
- **Book Link Consistency**: Standardized book links to use the shared URL helper.
|
|
20
|
+
|
|
21
|
+
### Docs
|
|
22
|
+
- **Developer Notes**: Added inline documentation for `getFeedItems()` behavior and configuration handling.
|
|
23
|
+
- **Repository Instructions**: Refreshed repository-level agent instructions to match the current workspace layout and release workflow.
|
|
24
|
+
|
|
25
|
+
## [1.10.0] - 2026-03-02
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- **Configurable URL Topology**: Added support for `posts.basePath` and `series.customPaths` so posts and series can be served under custom prefixes.
|
|
29
|
+
- **Single-Language Mode**: Added `i18n.enabled` to disable multilingual routing/UI when running a single-locale site.
|
|
30
|
+
- **Homepage Content Controls**: Added pinned-post support and optional post subtitles for improved featured and latest sections.
|
|
31
|
+
- **Author Profile Expansion**: Added configurable default authors plus optional author avatar/social images and header/card visibility toggles.
|
|
32
|
+
- **Publishing Controls**: Added `posts.excludeFromListing` to keep selected series posts out of the main `/posts` feed.
|
|
33
|
+
- **Deployment & Media**: Added one-command Linux/nginx deploy script and `images.cdnBaseUrl` support for serving images from a CDN.
|
|
34
|
+
- **Branding Controls**: Added configurable logo and favicon paths in `site.config.ts`.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
- **Homepage Design System**: Refined homepage layout and card hierarchy across hero, featured content, latest writing, and series sections.
|
|
38
|
+
- **Subscribe Surface**: Moved `/subscribe` to content-driven authoring so users can fully edit subscription copy in Markdown/MDX.
|
|
39
|
+
- **Documentation**: Updated architecture, deployment, and configuration guides to reflect current routing and feature behavior.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- **Static Export Stability**: Fixed `output: "export"` edge cases by returning placeholder params for empty/disabled dynamic routes.
|
|
43
|
+
- **Dynamic Routing Conflicts**: Resolved route naming and generation conflicts for custom prefixes and static params.
|
|
44
|
+
- **Navigation Consistency**: Fixed mismatch between navigation post URL and configured posts base path.
|
|
45
|
+
- **Book Route Safety**: Prevented invalid book chapter params by validating chapter existence before route generation.
|
|
46
|
+
- **Image Handling**: Fixed markdown image path resolution across content types and ensured CDN prefixing is applied consistently.
|
|
47
|
+
- **Rendering & Type Safety**: Fixed TypeScript handling for custom `rss-feed` element and addressed dev-time WebP 404 behavior.
|
|
48
|
+
|
|
8
49
|
## [1.9.0] - 2026-02-28
|
|
9
50
|
|
|
10
51
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -25,6 +25,9 @@ bun run build # Full production build (copies assets, builds Next.j
|
|
|
25
25
|
bun run build:dev # Development build (no image optimization, faster) — also regenerates Pagefind search index in public/pagefind/
|
|
26
26
|
bun run clean # Remove .next, out, public/posts directories
|
|
27
27
|
|
|
28
|
+
# Deploy
|
|
29
|
+
bun run deploy # Deploy out/ to Linux/nginx server via rsync+sshpass (reads .env.local)
|
|
30
|
+
|
|
28
31
|
# Content creation
|
|
29
32
|
bun run new "Post Title" # Create new post
|
|
30
33
|
bun run new-series "Series Name" # Create new series
|
|
@@ -49,6 +52,7 @@ bun run sync-book <slug> # Sync chapters list for one book
|
|
|
49
52
|
|
|
50
53
|
- `site.config.ts` - Site configuration (nav, social, pagination, themes, i18n, analytics, comments)
|
|
51
54
|
- `src/lib/markdown.ts` - Data access layer with all content query functions
|
|
55
|
+
- `src/lib/urls.ts` - Central URL helpers (`getPostUrl`, `getPostsBasePath`, `getSeriesCustomPaths`, etc.) — always use these instead of hardcoding `/posts/[slug]`
|
|
52
56
|
- `src/lib/search-utils.ts` - Pure search utilities (URL type detection, date extraction, title cleaning, markdown stripping) shared by `Search` and the search index route
|
|
53
57
|
- `src/app/globals.css` - Theme CSS variables and color palettes
|
|
54
58
|
- `src/components/MarkdownRenderer.tsx` - MDX rendering with all plugins
|
|
@@ -74,7 +78,9 @@ bun run sync-book <slug> # Sync chapters list for one book
|
|
|
74
78
|
- `/flows/[year]` - Flows filtered by year
|
|
75
79
|
- `/flows/[year]/[month]` - Flows filtered by month
|
|
76
80
|
- `/flows/[year]/[month]/[day]` - Single flow detail page
|
|
77
|
-
- `/[slug]` - Static pages (about, etc.)
|
|
81
|
+
- `/[slug]` - Static pages (about, subscribe, etc.) and custom posts/series listing pages
|
|
82
|
+
- `/[prefix]/[slug]` - Posts at custom URL prefixes (e.g. `/articles/my-post`, `/weeklies/my-post`)
|
|
83
|
+
- `/[prefix]/page/[page]` - Paginated listing at custom URL prefixes
|
|
78
84
|
|
|
79
85
|
### Content Structure
|
|
80
86
|
|
|
@@ -90,20 +96,40 @@ bun run sync-book <slug> # Sync chapters list for one book
|
|
|
90
96
|
|
|
91
97
|
Date-prefixed filenames (`2026-01-01-my-post.mdx`) extract dates automatically.
|
|
92
98
|
|
|
99
|
+
## Config Files
|
|
100
|
+
|
|
101
|
+
There are two config files that must be kept in sync:
|
|
102
|
+
|
|
103
|
+
- **`site.config.ts`** — the live config for this repo (i18n enabled; locale-aware fields use `{ en: '...', zh: '...' }` objects)
|
|
104
|
+
- **`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
|
|
105
|
+
|
|
106
|
+
**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.
|
|
107
|
+
|
|
93
108
|
## Configuration (`site.config.ts`)
|
|
94
109
|
|
|
95
110
|
Key configuration options:
|
|
96
111
|
- `nav` - Navigation links with weights
|
|
97
112
|
- `social` - GitHub, Twitter, email links for footer
|
|
98
113
|
- `series.navbar` - Series slugs to show in navbar dropdown
|
|
114
|
+
- `series.customPaths` - Per-series custom URL prefix e.g. `{ 'weeklies': 'weeklies' }` → posts at `/weeklies/[slug]`
|
|
99
115
|
- `pagination.posts`, `pagination.series` - Items per page
|
|
100
116
|
- `themeColor` - 'default' | 'blue' | 'rose' | 'amber'
|
|
101
117
|
- `hero` - Homepage hero title and subtitle
|
|
102
118
|
- `i18n` - Default locale and supported locales
|
|
103
119
|
- `featured.series` - Scrollable series: `scrollThreshold` (default: 2), `maxItems` (default: 6)
|
|
104
120
|
- `featured.stories` - Scrollable stories: `scrollThreshold` (default: 1), `maxItems` (default: 5)
|
|
105
|
-
- `analytics.
|
|
121
|
+
- `analytics.providers` - array of enabled providers: `['umami', 'google']`; `[]` disables analytics
|
|
106
122
|
- `comments.provider` - 'giscus' | 'disqus' | null
|
|
123
|
+
- `feed.format` - 'rss' | 'atom' | 'both'
|
|
124
|
+
- `feed.content` - 'full' | 'excerpt'
|
|
125
|
+
- `feed.maxItems` - max feed items (0 = unlimited)
|
|
126
|
+
- `footer.bottomLinks` - custom links in the footer bottom bar (ICP, cookie policy, etc.); `text` accepts plain string or `{ en, zh }` locale map
|
|
127
|
+
- `posts.basePath` - Custom URL prefix for all posts (default: `'posts'`); e.g. `'articles'` → posts at `/articles/[slug]`
|
|
128
|
+
- `posts.authors.default` - Fallback authors when a post has none set in frontmatter
|
|
129
|
+
- `posts.authors.showInHeader` - Show author byline below post title (default: true)
|
|
130
|
+
- `posts.authors.showAuthorCard` - Show author card at end of post (default: true)
|
|
131
|
+
- `posts.excludeFromListing` - Series slugs whose posts are hidden from `/posts` listing pages
|
|
132
|
+
- `authors` - Per-author profiles: `bio`, `avatar` (image path), `social` (array of `{ image, description }`)
|
|
107
133
|
|
|
108
134
|
## Content Frontmatter
|
|
109
135
|
|
|
@@ -112,6 +138,7 @@ Key configuration options:
|
|
|
112
138
|
```yaml
|
|
113
139
|
---
|
|
114
140
|
title: "Post Title"
|
|
141
|
+
subtitle: "Optional subtitle line" # Rendered below the title in italic
|
|
115
142
|
date: "2026-01-01"
|
|
116
143
|
excerpt: "Optional summary (auto-generated if omitted)"
|
|
117
144
|
category: "Category Name"
|
|
@@ -120,6 +147,7 @@ authors: ["Author Name"]
|
|
|
120
147
|
series: "series-slug" # Link to a series
|
|
121
148
|
draft: true # Hidden in production
|
|
122
149
|
featured: true # Show in featured section
|
|
150
|
+
pinned: true # Always shown in featured section; never shuffled away (hero = most recent pinned)
|
|
123
151
|
coverImage: "./images/cover.jpg" # Local or external URL
|
|
124
152
|
latex: true # Enable KaTeX math
|
|
125
153
|
toc: false # Hide table of contents
|
package/README.md
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
# Amytis
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.md) | [简体中文](README.zh.md)
|
|
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.
|
|
4
6
|
|
|
5
7
|
[**Live Demo**](https://amytis.vercel.app/)
|
|
6
8
|
|
|
7
|
-

|
|
10
|
+
|
|
11
|
+
## The Knowledge Ladder
|
|
12
|
+
|
|
13
|
+
Amytis is built around a simple path from rough to refined:
|
|
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.
|
|
19
|
+
|
|
20
|
+
Each stage builds on the previous one, so your garden can evolve naturally.
|
|
8
21
|
|
|
9
22
|
## Features
|
|
10
23
|
|
|
@@ -37,9 +50,13 @@
|
|
|
37
50
|
- Co-located assets: keep images inside post folders (`./images/`).
|
|
38
51
|
- Date-prefixed filenames: `2026-01-01-my-post.mdx`.
|
|
39
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.
|
|
40
54
|
- **Performance & SEO:**
|
|
41
55
|
- Fully static export with optimized WebP images.
|
|
42
|
-
-
|
|
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.
|
|
43
60
|
- Multilingual reading time estimate (supports Latin and CJK).
|
|
44
61
|
- **Integrations:**
|
|
45
62
|
- Analytics: Umami, Plausible, or Google Analytics.
|
|
@@ -48,8 +65,30 @@
|
|
|
48
65
|
- **Content CLI Tools:** Create posts, series, and import from PDFs or image folders.
|
|
49
66
|
- **Modern Stack:** Next.js 16, React 19, Tailwind CSS v4, TypeScript 5, Bun.
|
|
50
67
|
|
|
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
|
+
|
|
51
76
|
## Quick Start
|
|
52
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
|
+
|
|
53
92
|
1. **Install Dependencies:**
|
|
54
93
|
```bash
|
|
55
94
|
bun install
|
|
@@ -61,6 +100,8 @@
|
|
|
61
100
|
```
|
|
62
101
|
Visit [http://localhost:3000](http://localhost:3000).
|
|
63
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
|
+
|
|
64
105
|
3. **Build for Production (Static Export):**
|
|
65
106
|
```bash
|
|
66
107
|
bun run build
|
|
@@ -75,67 +116,49 @@
|
|
|
75
116
|
## CLI Commands
|
|
76
117
|
|
|
77
118
|
```bash
|
|
78
|
-
|
|
79
|
-
bun dev
|
|
80
|
-
bun run lint
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
bun run build
|
|
85
|
-
bun run
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
bun
|
|
91
|
-
bun run test:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
bun run new "Title"
|
|
97
|
-
bun run new "
|
|
98
|
-
bun run new "
|
|
99
|
-
bun run new "
|
|
100
|
-
bun run new-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
bun run new-from-pdf doc.pdf
|
|
104
|
-
bun run new-from-images ./photos
|
|
105
|
-
bun run new-from-
|
|
106
|
-
bun run
|
|
107
|
-
bun run
|
|
108
|
-
bun run
|
|
109
|
-
bun run new-flow-from-chat # Import all new files in imports/chats/
|
|
110
|
-
bun run sync-book # Sync book chapters with files on disk
|
|
111
|
-
bun run series-draft "series-slug" # Set all posts in a series to draft
|
|
112
|
-
bun run series-draft "series-slug" --undraft # Remove draft status from series posts
|
|
119
|
+
## Core
|
|
120
|
+
bun dev
|
|
121
|
+
bun run lint
|
|
122
|
+
bun run validate
|
|
123
|
+
|
|
124
|
+
## Build & Deploy
|
|
125
|
+
bun run build
|
|
126
|
+
bun run build:dev
|
|
127
|
+
bun run clean
|
|
128
|
+
bun run deploy # Deploy to Linux/nginx server (requires .env.local)
|
|
129
|
+
|
|
130
|
+
## Test
|
|
131
|
+
bun test
|
|
132
|
+
bun run test:unit
|
|
133
|
+
bun run test:int
|
|
134
|
+
bun run test:e2e
|
|
135
|
+
|
|
136
|
+
## Create Content
|
|
137
|
+
bun run new "Post Title"
|
|
138
|
+
bun run new-weekly "Weekly Topic"
|
|
139
|
+
bun run new-series "Series Name"
|
|
140
|
+
bun run new-note "Concept"
|
|
141
|
+
bun run new-flow
|
|
142
|
+
|
|
143
|
+
## Import / Maintain
|
|
144
|
+
bun run new-from-pdf ./doc.pdf
|
|
145
|
+
bun run new-from-images ./photos
|
|
146
|
+
bun run new-flow-from-chat
|
|
147
|
+
bun run import-book
|
|
148
|
+
bun run sync-book
|
|
149
|
+
bun run series-draft "series-slug"
|
|
113
150
|
```
|
|
114
151
|
|
|
115
152
|
### Importing Chat Logs to Flows
|
|
116
153
|
|
|
117
|
-
|
|
154
|
+
Drop `.txt` or `.log` files into `imports/chats/`, then run:
|
|
118
155
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Author Name YYYY-MM-DD HH:mm:ss
|
|
123
|
-
Message content line 1
|
|
124
|
-
Message content line 2
|
|
125
|
-
```
|
|
126
|
-
3. Run the importer:
|
|
127
|
-
```bash
|
|
128
|
-
bun run new-flow-from-chat
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Options:
|
|
132
|
-
- `--all`: Re-import every file (ignores history).
|
|
133
|
-
- `--dry-run`: Preview changes without writing files.
|
|
134
|
-
- `--author "Name"`: Only include messages from a specific author.
|
|
135
|
-
- `--append`: Append to existing flow files instead of skipping.
|
|
136
|
-
- `--timestamp`: Include timestamps in the rendered blocks.
|
|
156
|
+
```bash
|
|
157
|
+
bun run new-flow-from-chat
|
|
158
|
+
```
|
|
137
159
|
|
|
138
|
-
|
|
160
|
+
Common flags: `--all`, `--dry-run`, `--author "Name"`, `--append`, `--timestamp`.
|
|
161
|
+
Import history is stored in `imports/chats/.imported`.
|
|
139
162
|
|
|
140
163
|
## Configuration
|
|
141
164
|
|
|
@@ -202,12 +225,15 @@ amytis/
|
|
|
202
225
|
components/ # React components
|
|
203
226
|
lib/
|
|
204
227
|
markdown.ts # Data access layer
|
|
228
|
+
packages/
|
|
229
|
+
create-amytis/ # `bun create amytis` scaffold CLI
|
|
205
230
|
site.config.ts # Site configuration
|
|
206
231
|
```
|
|
207
232
|
|
|
208
233
|
## Documentation
|
|
209
234
|
|
|
210
235
|
- [Architecture Overview](docs/ARCHITECTURE.md)
|
|
236
|
+
- [Deployment Guide](docs/deployment.md)
|
|
211
237
|
- [Digital Garden Guide](docs/DIGITAL_GARDEN.md)
|
|
212
238
|
- [Contributing Guide](docs/CONTRIBUTING.md)
|
|
213
239
|
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Amytis
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [简体中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
**Amytis** 是一个优雅的开源数字花园框架,用于构建个人知识空间。它基于 Next.js 16、React 19 和 Tailwind CSS v4,强调可读性、结构化表达与长期内容所有权。
|
|
6
|
+
|
|
7
|
+
[**在线演示**](https://amytis.vercel.app/)
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## 知识阶梯
|
|
12
|
+
|
|
13
|
+
Amytis 围绕一条从粗糙到精炼的知识路径构建:
|
|
14
|
+
|
|
15
|
+
- **Flow(随笔)**:记录每日想法与碎片。
|
|
16
|
+
- **Articles(文章)**:将单个想法打磨成清晰文章。
|
|
17
|
+
- **Series(系列)**:把相关文章串联为一条主题叙事。
|
|
18
|
+
- **Books(书籍)**:将成熟知识沉淀为章节化结构。
|
|
19
|
+
|
|
20
|
+
每个阶段都建立在上一阶段之上,花园会自然生长。
|
|
21
|
+
|
|
22
|
+
## 功能特性
|
|
23
|
+
|
|
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 优先但不受限**:保持可迁移写作体验,同时支持数学、图表、代码和双向链接。
|
|
64
|
+
- **按需启用**:`site.config.ts` 提供模块化开关,仅启用你需要的能力。
|
|
65
|
+
- **纯文本长期所有权**:内容存储于 Markdown/MDX,便于版本管理与长期迁移。
|
|
66
|
+
|
|
67
|
+
## 快速开始
|
|
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
|
+
|
|
83
|
+
1. **安装依赖**
|
|
84
|
+
```bash
|
|
85
|
+
bun install
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. **启动开发环境**
|
|
89
|
+
```bash
|
|
90
|
+
bun dev
|
|
91
|
+
```
|
|
92
|
+
打开 [http://localhost:3000](http://localhost:3000)。
|
|
93
|
+
|
|
94
|
+
> **本地搜索说明:** Pagefind 索引是在执行 `bun run build:dev` 时生成的。本地测试 Cmd/Ctrl+K 前先运行一次;内容更新后也需要重新生成。
|
|
95
|
+
|
|
96
|
+
3. **生产构建(静态导出)**
|
|
97
|
+
```bash
|
|
98
|
+
bun run build
|
|
99
|
+
```
|
|
100
|
+
产物位于 `out/` 目录。
|
|
101
|
+
|
|
102
|
+
4. **开发构建(更快,无图片优化)**
|
|
103
|
+
```bash
|
|
104
|
+
bun run build:dev
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## CLI 命令
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
## Core
|
|
111
|
+
bun dev
|
|
112
|
+
bun run lint
|
|
113
|
+
bun run validate
|
|
114
|
+
|
|
115
|
+
## Build & Deploy
|
|
116
|
+
bun run build
|
|
117
|
+
bun run build:dev
|
|
118
|
+
bun run clean
|
|
119
|
+
bun run deploy # 部署到 Linux/nginx 服务器(需要 .env.local 配置)
|
|
120
|
+
|
|
121
|
+
## Test
|
|
122
|
+
bun test
|
|
123
|
+
bun run test:unit
|
|
124
|
+
bun run test:int
|
|
125
|
+
bun run test:e2e
|
|
126
|
+
|
|
127
|
+
## Create Content
|
|
128
|
+
bun run new "Post Title"
|
|
129
|
+
bun run new-weekly "Weekly Topic"
|
|
130
|
+
bun run new-series "Series Name"
|
|
131
|
+
bun run new-note "Concept"
|
|
132
|
+
bun run new-flow
|
|
133
|
+
|
|
134
|
+
## Import / Maintain
|
|
135
|
+
bun run new-from-pdf ./doc.pdf
|
|
136
|
+
bun run new-from-images ./photos
|
|
137
|
+
bun run new-flow-from-chat
|
|
138
|
+
bun run import-book
|
|
139
|
+
bun run sync-book
|
|
140
|
+
bun run series-draft "series-slug"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 导入聊天记录到 Flows
|
|
144
|
+
|
|
145
|
+
将 `.txt` 或 `.log` 文件放入 `imports/chats/` 后执行:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
bun run new-flow-from-chat
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
常用参数:`--all`、`--dry-run`、`--author "Name"`、`--append`、`--timestamp`。
|
|
152
|
+
导入历史记录位于 `imports/chats/.imported`。
|
|
153
|
+
|
|
154
|
+
## 配置
|
|
155
|
+
|
|
156
|
+
所有站点配置集中在 `site.config.ts`。
|
|
157
|
+
|
|
158
|
+
## 内容写作
|
|
159
|
+
|
|
160
|
+
- **Posts**:创建到 `content/posts/`
|
|
161
|
+
- **Flows**:创建到 `content/flows/YYYY/MM/DD.mdx`(或文件夹模式)
|
|
162
|
+
- **Series**:创建 `content/series/<slug>/index.mdx`
|
|
163
|
+
- **Books**:创建到 `content/books/<slug>/`
|
|
164
|
+
- **Notes**:创建到 `content/notes/`,支持 `[[wiki-links]]`
|
|
165
|
+
|
|
166
|
+
## 项目结构
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
amytis/
|
|
170
|
+
content/
|
|
171
|
+
posts/
|
|
172
|
+
series/
|
|
173
|
+
books/
|
|
174
|
+
notes/
|
|
175
|
+
flows/
|
|
176
|
+
public/
|
|
177
|
+
src/
|
|
178
|
+
app/
|
|
179
|
+
components/
|
|
180
|
+
lib/
|
|
181
|
+
packages/
|
|
182
|
+
create-amytis/
|
|
183
|
+
site.config.ts
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## 文档
|
|
187
|
+
|
|
188
|
+
- [架构说明](docs/ARCHITECTURE.md)
|
|
189
|
+
- [部署指南](docs/deployment.md)
|
|
190
|
+
- [数字花园指南](docs/DIGITAL_GARDEN.md)
|
|
191
|
+
- [贡献指南](docs/CONTRIBUTING.md)
|
|
192
|
+
|
|
193
|
+
## 许可证
|
|
194
|
+
|
|
195
|
+
MIT
|
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
|
-
- [ ] **
|
|
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
|
-
- [ ] **
|
|
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.
|