Skip to content

Put each Kiln post's Chinese and English on one page with a language switch - #21

Merged
ShuminFu merged 1 commit into
mainfrom
claude/sleepy-gauss-284pwd
Nov 23, 2026
Merged

ShuminFu merged 1 commit into
mainfrom
claude/sleepy-gauss-284pwd

Conversation

@ShuminFu

Copy link
Copy Markdown
Owner

What does this PR do?

Follow-up to #20. Each Kiln post now holds both languages on one page behind a 中文 / English switch, Chinese by default:

  • kiln-automation-flow and kiln-orca-connector contain a <section lang="zh-CN"> and a <section lang="en" data-alt-lang>. The switch is two radio inputs and CSS, so it works without JavaScript; a small inline script opens English from a #en link and keeps the hash in step with the switch.
  • The separate -en posts are removed. public/_redirects sends their old addresses to /posts/<slug>/#en.
  • src/utils/reading.ts and post-audit.mjs skip a section marked data-alt-lang, so the reading time counts one language (10 and 8 min) instead of both.

The page header (title, description, tags) comes from the layout and stays Chinese; the English section opens with its own title.

How to test

  1. npm run build
  2. npx astro preview --port 4329
  3. Open /posts/kiln-automation-flow/: Chinese shows; click English; open /posts/kiln-orca-connector/#en: English shows.
  4. node .claude/skills/post-review/scripts/post-audit.mjs --only kiln-automation-flow (and kiln-orca-connector)

Checklist

  • npm run build passes
  • Tested in light and dark mode (switch and #en checked at 375px in a browser, including keyboard arrows)
  • Tested with at least two themes (e.g. sage, classic): not done; the switch uses only --foreground, --background, --muted and --accent
  • No new warnings in the console (no page errors in the browser test)
  • post-audit.mjs and measure.mjs clean for both posts. The full audit's one defect is the existing robotics-six-month-roadmap (base64 images), untouched here

Generated by Claude Code

…switch

Each post now holds both languages behind a 中文 / English switch, Chinese
by default. The switch is two radio inputs and CSS, so it works without
JavaScript; a small script opens English from a #en link and keeps the
hash in step. The separate -en posts are removed and their addresses
redirect to the merged page's #en.

Reading time counted both languages. reading.ts and post-audit.mjs now
skip a section marked data-alt-lang, so a bilingual note shows the time
for one language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NzupDBSP7FkrPA5FsJbeYs
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying fun-fun-zone with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1f34a20
Status: ✅  Deploy successful!
Preview URL: https://81de02fe.fun-fun-zone.pages.dev
Branch Preview URL: https://claude-sleepy-gauss-284pwd.fun-fun-zone.pages.dev

View logs

@ShuminFu
ShuminFu merged commit 6d0a043 into main Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants