01
Getting Started
Component
Frontmatter between ---, then HTML template.
astro
---
const title = "Hello";
---
<h1>{title}</h1>Props
Props via Astro.props.
astro
---
interface Props { name: string; }
const { name } = Astro.props;
---
<h1>Hello {name}</h1>Pages
File-based routing in src/pages/.
astro
---
// src/pages/index.astro
---
<html><body>Hello</body></html>02
Features
Islands
client: directives for hydration: load, idle, visible, only.
astro
---
import Counter from "../components/Counter.tsx";
---
<Counter client:load />Dynamic Routes
getStaticPaths for dynamic SSG routes.
astro
---
export async function getStaticPaths() {
return posts.map(p => ({ params: { slug: p.slug }, props: p }));
}
const post = Astro.props;
---Content Collections
Type-safe content collections.
astro
---
import { getCollection } from "astro:content";
const posts = await getCollection("blog");
---Was this helpful?