用途:使用 Astro 构建快速、以内容为中心的网站,默认输出静态 HTML 且不主动引入客户端 JavaScript,仅在需要时通过 islands 架构做局部水合。
主要能力:1) .astro 文件由 frontmatter(构建时运行)与模板两部分组成,支持组件 Props 与 scoped 样式;2) islands 架构支持 client:load、client:idle、client:visible、client:media、client:only 指令按需水合;3) 内容集合通过 defineCollection + zod schema 提供类型安全的内容管理,使用 getCollection、getEntry 查询;4) 内置 astro:assets 的 Image 组件做图片优化;5) 支持 View Transitions 与 Web Components;6) 通过适配器与 output 配置静态、SSR 或混合输出。
使用方式:按 src/pages(文件路由)、components、layouts、content、styles 组织项目;在 astro.config.mjs 中用 defineConfig 设置 site、output、adapter 与 integrations;部署示例:Cloudflare Pages 使用 npx wrangler pages deploy dist;Node.js 适配器以 node dist/server/entry.mjs 启动。
适用场景:内容型网站、博客等以静态输出为主、需要少量交互的站点。
限制:默认静态输出不适合强 SSR 需求,SSR/混合需选择匹配的适配器;远程图片须指定尺寸;交互组件须显式使用 client:* 指令。具体收费、价格与平台细节暂未提供。