Astro — framework static site generation dla SEO
Czym jest Astro?
Astro to web framework do budowy szybkich stron content-first — blogów, dokumentacji, landing pages, e-commerce. Powstał w 2021 (v1.0 w sierpniu 2022), obecnie wersja 6.x (2026). Główna idea: zero-JS by default — strony są pre-rendered jako pure HTML, JavaScript ładowany tylko gdy potrzebny (islands architecture).
Astro pozycjonowany jest jako content-focused alternative dla Next.js/Nuxt — które są bardziej app-focused.
Kluczowe cechy
- Multi-framework — możesz mieszać React + Vue + Svelte + Solid w jednej stronie
- Islands architecture — interaktywne komponenty (islands) hydratują się osobno; reszta to pure HTML
- MDX support — pisz content w Markdown + JSX
- SSG default — server-side render do statycznego HTML w build time
- SSR opcjonalny — adapter Vercel/Netlify/Cloudflare dla dynamicznych routes
- Built-in image optimization —
<Image>component z auto WebP/AVIF - Built-in sitemap, RSS, content collections — wszystko out-of-the-box
- TypeScript first — pełna obsługa types
Astro vs Next.js
| Aspekt | Astro | Next.js |
|---|---|---|
| Primary use case | Content sites (blogi, docs) | Web apps + content |
| JS bundle size | Zero-JS by default | ~80-120KB minimum |
| Hydration | Partial (islands) | Full page lub server components |
| Build time | Bardzo szybki | Wolniejszy dla dużych sites |
| Routing | File-based | File-based |
| API routes | Limited (SSR adapter) | Full API routes |
| Image optimization | Built-in | Built-in (sharp) |
| Learning curve | Łagodny | Stromy (server components, app router) |
| Core Web Vitals | Top-tier (zero-JS) | Wymaga manual tuning |
Werdykt: Astro dla blogów, docs, landing pages. Next.js dla SaaS apps, dashboardy.
Astro a SEO
Astro jest najbardziej SEO-friendly framework w 2026 dla content sites:
- Native SSG → instant HTML do Googlebota, brak JS-rendering issues
- Bezbabel zero-JS → szybkie LCP/INP/CLS
- Built-in sitemap → auto-generated z routes
- Schema markup easy → server-side rendering pełnego JSON-LD
- MDX dla blog → frontmatter + content w jednym
- Content collections → type-safe content management
Stack typowo z Astro
- Hosting: Cloudflare Pages, Vercel, Netlify
- CMS: Sanity, Contentful, Hygraph, lub markdown w repo
- Styling: Tailwind CSS, CSS modules
- Search: Pagefind (static search), Algolia DocSearch
- Forms: Cloudflare Workers, Netlify Forms, Formspree
- Analytics: Plausible, Fathom, Google Analytics
Performance benchmarks
Typowe Astro site (2026 measurements na Cloudflare Pages):
- LCP mobile: 1.2-2.5s (Good zone)
- INP: poniżej 200ms (Good)
- CLS: 0.01-0.05 (Good)
- Lighthouse score: 95-100
Większość Astro sites uzyskuje top 1-5% w Core Web Vitals globally.
Kiedy NIE używać Astro?
- Aplikacje SaaS z heavy state → Next.js / Remix
- Real-time apps (chat, dashboards) → Next.js z server actions
- E-commerce z koszykiem w SPA mode → Next.js z React Query
- Marketplace z search/filter UI → Next.js
Powiązane pojęcia
- Cloudflare Pages — preferowany hosting
- Core Web Vitals — gdzie Astro wygrywa
- SEO — Astro = SEO-first
- Lighthouse — primary perf tool
- Static site generation — paradygmat Astro
- Information gain — Astro content jest indexable