| name | new-landing-page |
| description | Scaffold a new landing site page following i18n patterns (shared component + EN/VI wrappers + translation keys) |
New Landing Page Scaffolder
Create a new page for the Astro landing site at landing/ with proper i18n support.
Usage
The user will provide:
- name: The page name/slug (e.g., "changelog", "features")
- title: Page title for
<title> tag
- description: What the page is about
- translatable: Whether it needs EN + VI versions (default: yes)
What Gets Created
For translatable pages (default)
- Shared page component:
landing/src/components/pages/{Name}Page.astro
- EN page wrapper:
landing/src/pages/{name}.astro
- VI page wrapper:
landing/src/pages/vi/{name}.astro
- Translation keys: Added to both EN and VI sections in
landing/src/i18n/ui.ts
For EN-only pages (translatable: false)
- Page file:
landing/src/pages/{name}.astro
- No translation keys needed — content can be hardcoded or from content collection
Shared Page Component Pattern
---
import BaseLayout from "../../layouts/BaseLayout.astro";
import { useTranslations, useTranslatedPath } from "../../i18n/utils";
import type { Lang } from "../../i18n/utils";
interface Props {
lang: Lang;
}
const { lang } = Astro.props;
const t = useTranslations(lang);
const tp = useTranslatedPath(lang);
const hreflang = [
{ lang: "en", href: "/{name}" },
{ lang: "vi", href: "/vi/{name}" },
];
---
<BaseLayout title={`${t("{name}.title")} | 3AT - Endless Paradox`} lang={lang} hreflang={hreflang}>
<div class="container">
<!-- Page content using t() for all text -->
</div>
</BaseLayout>
<style>
/* Scoped styles only — use CSS variables from global.css */
</style>
Thin Wrapper Pattern
---
// landing/src/pages/{name}.astro (EN)
import {Name}Page from "../components/pages/{Name}Page.astro";
---
<{Name}Page lang="en" />
---
// landing/src/pages/vi/{name}.astro (VI)
import {Name}Page from "../../components/pages/{Name}Page.astro";
---
<{Name}Page lang="vi" />
Translation Keys Pattern
Add to landing/src/i18n/ui.ts in BOTH en and vi sections:
"{name}.title": "Page Title",
"{name}.subtitle": "Page subtitle text",
"{name}.title": "Tiêu đề trang",
"{name}.subtitle": "Mô tả phụ đề trang",
Rules
- Always use
t() for user-facing text — never hardcode strings
- Always add keys to BOTH EN and VI in
ui.ts
- Use scoped
<style> — never add to global.css
- Use CSS variables from global.css:
var(--accent), var(--bg-primary), var(--text-secondary), etc.
- Include hreflang tags in the shared component for SEO
- Pass
lang to all child components that accept it
- Use
useTranslatedPath() for all internal links
- If the page needs nav/footer links, update
Navbar.astro and Footer.astro with translated entries
Checklist
After scaffolding, verify: