Engineering1 min read
Hello World: Why This Site Runs on Astro
(Sample post) Notes on the stack behind this site: Astro, Content Collections and bilingual routing.
This is a sample post used to verify the content model, bilingual routing and code blocks. It will be replaced before launch.
Why Astro
A content site barely needs a client-side framework runtime. Astro ships plain HTML by default and loads interactivity only where needed.
Zero JS by default
Post pages only ship a tiny script for the table-of-contents highlight.
How translations pair up
Both versions share a filename, e.g. zh-tw/hello-world.mdx and en/hello-world.mdx.
export function getLocalizedPath(path: string, lang: Lang): string { const clean = `/${path.replace(/^\/+/, '')}`; return lang === defaultLang ? clean : `/${lang}${clean}`; // no prefix for the default language}What changed
const site = 'https://example.pages.dev';const site = profile.site.url;Wrapping up
New posts are created with npm run new:post -- <slug>.