Repository navigation
Rebase 到 astro-paper v6.1(Astro 6 + 纯静态 Cloudflare Pages + 双语) - #4
Merged
Merged
Conversation
- astro ^6.4.2, tailwind ^4.3, ts ^6, eslint ^10 - add @astrojs/mdx, rehype-callouts, slugify (v6.1 features) - fork deps on Astro 6: @astrojs/cloudflare ^13.7, @astrojs/react ^5, @keystatic/astro ^5.1, wrangler ^4.83 - adopt upstream eslint.config.js / .prettierrc / .prettierignore - merge tsconfig (react jsx + @/astro-paper.config path) - pnpm-workspace allowBuilds for sharp/resvg/workerd/esbuild Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…orkers variant)
Adopts upstream v6.1 config architecture (astro-paper.config.ts + src/config.ts
resolver + src/types/config.ts) with bilingual i18n (zh default at /, en at /en/),
content moved to src/content/posts/{zh,en}, Keystatic paths + repo updated, and
the Cloudflare Workers adapter (wrangler.jsonc rewritten for Workers Static Assets).
NOTE: this commit preserves the Keystatic + Cloudflare adapter setup for the
`keystatic-workers` compatibility branch. The Astro 6 Cloudflare adapter currently
fails static prerendering in the workerd runtime (withastro/astro#15684, #15650),
so main switches to a pure-static build for Cloudflare Pages in the next commit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Drop Cloudflare Workers adapter + Keystatic + React (preserved on
keystatic-workers branch) due to Astro 6 adapter prerender bug.
- Pure-static build via Node prerender: astro check + build + pagefind all green.
- Content lives in src/content/posts/{zh,en}; collections sync; 13 pages build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ng helpers - src/i18n/lang/zh.ts: full Chinese translation of the UIStrings interface - src/i18n/helpers.ts: LOCALES list + getAlternatePath for the language switcher Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- getPostPaths: strip locale dir from slug, derive locale from post dir
- Root pages filter zh posts; English [lang]/ tree mirrors them (filters en)
- LanguageSwitcher in Header (upstream Header already locale-aware)
- Layout: loop-safe preferred-lang/browser-lang redirect script
- About content split into pages/{zh,en}/about.md
- Per-language RSS (/rss.xml zh, /en/rss.xml en); _redirects for legacy /zh/*
- astro check: 0 errors; build emits both /posts/welcome and /en/posts/welcome
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ploy - Re-enable dynamic OG images (satori + sharp) — works in the pure-static Node build; dual-tree routes (/posts/.../index.png zh, /en/posts/.../index.png en). CJK titles still fall back to the satori font set (pre-existing fork limitation). - Restore CJK body font: @chinese-fonts/sypxzs (Source Han Serif) + --font-app stack. - Cloudflare Pages deploy: _redirects (legacy /zh/* -> /*) copied into dist via the build script (placing it in public/ breaks the Vite build). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Update README.md / README-en.md for the v6.1 pure-static Cloudflare Pages setup - Add Branches section (main vs keystatic-workers) and a simple upstream-upgrade git flow (git fetch/merge upstream) + list of fork-specific files - Document the v6.1 rebase changes - prettier format pass (all files clean) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Astro 6 requires Node >=22.12; Cloudflare Pages defaults to an older Node unless told otherwise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
将项目从 Astro 5.16 全量 rebase 到上游 astro-paper v6.1(Astro 6.4 / Tailwind 4.3),保留全部双语能力,改为纯静态构建部署到 Cloudflare Pages。
关键决策(过程中确认)
@astrojs/cloudflarev13 放弃 Pages、只支持 Workers,且其 Astro 6 的 workerd 预渲染当前无法静态构建(withastro/astro#15684、#15650)→ 主分支改为纯静态留在 Pages;Keystatic/Workers 版保留在keystatic-workers分支。主要变更
^6.4、tailwind^4.3、ts^6、eslint^10;新增 mdx / rehype-callouts / slugify。astro-paper.config.ts+src/config.tsresolver +src/types/config.ts。src/data/blog/→src/content/posts/{zh,en},集合blog→posts。UIStrings+ 新增中文lang/zh.ts;getPostPaths从 slug 剥离语言目录、按目录推断语言。zh/过滤;新建src/pages/[lang]/**英文树(按en/过滤);LanguageSwitcher+ Layout 语言重定向脚本;分语言 RSS;_redirects处理历史/zh/*。@chinese-fonts/sypxzs思源屏显臻宋)。验证
pnpm build全绿:astro check0 错误、19 页、pagefind 索引 zh/en。astro preview实跑:16 个关键路由全部 200(中/英首页、文章、标签、归档、关于、搜索、两个 RSS、3 个 OG 图)。eslint通过、prettier --check全部符合。部署须知
pnpm build;Node 已由.nvmrc固定到 22.12。已知限制(README 已注明)
keystatic-workers分支需等上游 Cloudflare 适配器修复后才能构建/部署。🤖 Generated with Claude Code