Timestamp: 2025-11-07T19:58:00.000Z
This file tells any assisting agent (automation, AI, scripts) EXACTLY how to approach this bilingual Astro blog project.
Minimalist, performant bilingual (Chinese default, English secondary) static blog using Astro with custom minimal theme inspired by Astro Nano; clean SEO, translation pairing, dynamic OG images; future-friendly (search, typed i18n later).
- Explanations: patient, plain language; avoid heavy jargon unless clarified.
- Implementation: clear directory structure, small focused components, minimal client JS.
- Internationalization: Chinese default (no prefix), English under /en/.
- URL style: enforce trailing slashes.
- OG images: per-post dynamic generation; site-level image non-localized.
- UI strings: start with JSON (/src/i18n/{zh,en}.json); may migrate to typed TS later.
- Language switcher: global (site-wide preference), always visible; disable target if translation missing.
- Language detection: instant redirect at root (/) based on browser language; English fallback for unsupported locales.
- SEO: self-canonical per page; hreflang only for existing translations (zh-CN, en).
- Dependencies: Keep minimal, avoid complex tooling unless necessary.
- Site title: konakona
- Author: konakona (Samuel He)
- Contact: samuelhe52@outlook.com
(Updated 2025-11-07T19:58:00.000Z)
- Theme approach: Custom minimal theme (NOT using Astro Nano package due to dependency complexity). Goal is feature parity with Nano while maintaining bilingual-first design. See NANO_PARITY.md for checklist.
- Default locale: Chinese (no /zh prefix). English under /en/.
- translationSlug identical across languages (English string).
- Fallback: show available language; switcher always visible; disable target if missing translation.
- Sitemap: single combined sitemap with hreflang alternates.
- RSS: Planned - separate feeds per language.
- Language detection: instant redirect at root (/) via inline script; checks browser languages for zh/en, defaults to English for unsupported locales.
- Locale codes: hreflang zh-CN & en; og:locale zh_CN default, en_US alternate.
- OG images: Planned dynamic generation per-post.
- Canonicals: self per page; hreflang only for existing translations.
- Deployment: custom VM with Nginx + Let's Encrypt.
- CI/CD: GitHub Actions automated build & rsync deploy.
- URL style: trailing slash enforced.
- Domains: konakona.dev and blog.konakona.dev both serve the same build directly; blog.konakona.dev is the canonical URL, while blog.konakona52.com and konakona52.com redirect to it.
- UI strings: JSON for now; may migrate to TS later.
- Search: planned later (multilingual); defer in MVP.
- Styling: Custom CSS with CSS variables (not Tailwind yet, may add later for utilities).
- ✅ Astro initialized with bilingual structure.
- ✅ Content collections: src/content/posts/{zh,en}/.
- ✅ translationSlug in frontmatter to pair posts.
- ✅ Layout: html lang, canonical, hreflang, meta description, OG/Twitter tags.
- ✅ Language switcher (cookie + detection) with disabled states for missing translations.
- ✅ MissingTranslationNotice component.
- ✅ Combined sitemap with hreflang alternates.
- ✅ Header, PostList, PostHeader components.
- ✅ Light/dark mode support via CSS variables.
- ✅ Minimal responsive design.
- ✅ GitHub Actions deployment workflow.
- ✅ robots.txt.
- Lighthouse audit & optimization
- MDX support for rich content
- Better styling/polish
- Dynamic OG images
- UX enhancements (reading time, animations)
- RSS Feed (deferred)
- Combined sitemap (both locales; alternates only when translation exists).
- GitHub Actions workflow (build & rsync deploy to Nginx VM with TLS).
- Search (multilingual index strategy).
- Typed i18n (typesafe-i18n or TS modules).
- Advanced OG image styling variants.
- Respect consolidated decisions above; never change without explicit user instruction.
- Keep changes minimal and incremental; avoid large refactors without need.
- Prefer build-time solutions (static generation over client JS).
- Degrade gracefully when translation absent.
- Accessibility: proper lang attributes, alt text, readable contrast.
- Security: no secrets committed; deployment uses SSH keys in CI secrets.
- Theme transitions: All components must include CSS transitions for color, background, and border-color changes (0.3s ease-in-out) to prevent flashing when theme switches via in-page buttons. Match pattern in Layout.astro.
- No inline scripts: Server has CSP restrictions. All JavaScript must be in external files in /public/scripts/ directory. Exception: The root index.astro uses an inline script for instant language redirect (runs before body renders).
- src/i18n/: en.json, zh.json for UI strings.
- src/layouts/Layout.astro: central metadata + language logic.
- src/components/LanguageSwitcher.{astro|tsx}: cookie logic + disabled state.
- src/pages/index.astro (zh default), src/pages/en/index.astro.
- src/pages/en/posts/[slug]/ and src/pages/posts/[slug]/ for posts.
- scripts/ or lib/ for sitemap and OG generation utilities.
- Create Astro project & install dependencies (@astrojs/i18n).
- Scaffold content directories & sample bilingual post pair with translationSlug.
- Implement Layout with canonical + hreflang + OG tags.
- Add language switcher component (cookie + disable if missing counterpart).
- Implement dynamic OG image route.
- Generate combined sitemap at build.
- Add GitHub Actions workflow (.github/workflows/deploy.yml).
- Provide Nginx server block example (not auto-applied here).
When asking for clarification: list concise numbered questions. When presenting code: minimize extraneous comments; only clarify non-obvious logic.
Project phases detailed in PROJECT_PLAN.md (kept separately for task sequencing).
Append new sections under "Updates" with timestamps. Do not erase historical decisions.