← Back to Blog
Astro keywords cheat sheet board

🚀 Astro Keywords & Concepts Cheat Sheet

• 4 min read

A fast reference to Astro’s vocabulary—understand the islands architecture, component types, bundling strategies, configuration options, and deployment adapters. Includes tables for core keywords, file structure explanations, CLI scripts, and productivity shortcuts so new projects stay organised.

🚀 Astro Keywords & Concepts Cheat Sheet

This guide summarizes essential ideas you’ll meet when building with Astro: how it renders, how routing works, what goes where, and which terms matter.


🌌 Core Concepts

KeywordMeaning
AstroA static‑first site builder (SSG) using the “Islands Architecture”; ships HTML by default and loads JS only where needed.
Islands ArchitectureMost of the page is static HTML, while interactive components hydrate with JS. Great for performance.
ComponentAn .astro file or a framework component (React/Vue/Svelte) used to build pages.
Partial HydrationOnly hydrate components that need interactivity.
AdapterDeploy target adapter (Vercel/Netlify/Node/etc.).
RendererIntegration that enables a given UI framework in Astro (e.g., React/Vue/Svelte).

📂 Files & Structure

Path/FileMeaning
src/pages/Page files; each .astro becomes an HTML route.
src/components/Reusable components (.astro, .jsx, .vue, .svelte, etc.).
src/layouts/Layout templates. Use <slot /> to inject content.
public/Static assets copied verbatim to dist/.
astro.config.mjsMain project config: site info, integrations, adapter.
src/env.d.tsType definitions for .astro modules.
dist/Build output folder.

⚙️ Config Keywords (astro.config.mjs)

KeyMeaning
siteBase site URL for sitemap/RSS/canonicals.
baseSub‑path when deploying under a repo (e.g., GitHub Pages).
integrationsIntegrations list (e.g., @astrojs/react, @astrojs/sitemap).
adapterDeployment adapter selection.
output'static' (default) or 'server' for SSR.
trailingSlashURL behavior: 'always', 'never', or 'ignore'.
buildBuild options like output dir and paths.

🧩 Template Syntax

SyntaxMeaning
---Frontmatter fence for server‑side logic (JS/TS).
Astro.propsRead props passed into a page/component.
Astro.paramsDynamic route params (e.g., id in [id].astro).
Astro.requestIncoming request (SSR only).
<slot />Slots for layouts/children.
{}Insert expressions inside HTML.

🌍 Routing

KeywordMeaning
File‑based routingRoutes mirror src/pages directory.
Dynamic routesBracket params: [id].astro/123.
Nested routesFolders create nesting: blog/[slug].astro/blog/post.
getStaticPaths()Return all paths for dynamic pages.
Astro.redirect()Redirect at build or request time.

💫 Integrations & Frameworks

KeywordMeaning
IntegrationsExtend Astro (framework support, MDX, sitemap, etc.).
@astrojs/reactRender React components in Astro.
@astrojs/vueRender Vue components in Astro.
@astrojs/svelteRender Svelte components in Astro.
@astrojs/mdxUse components inside .mdx files.

📖 Markdown & Content

KeywordMeaning
Content CollectionsStructured content system for Markdown/MDX.
FrontmatterYAML metadata block at file top.
Content EntryA single Markdown file (one document).
getCollection()Read documents from a collection.
slugShort URL based on file path/name.

Tip: For i18n, keep the same slugBase across languages and mark locale in frontmatter.


⚡ Build & Deploy

KeywordMeaning
SSGStatic Site Generation at build time.
SSRServer‑side rendering on request.
HybridMix SSG and SSR as needed.
Vercel / Netlify / CloudflareCommon deployment targets.
astro previewPreview built output locally.

🎨 Styling & Assets

KeywordMeaning
Scoped CSS<style> in .astro is scoped to the component by default.
Global StylesUse :global() or import a global stylesheet.
Tailwind / UnoCSS / SCSSUse via integrations.
Image OptimizationOptimize images via @astrojs/image or astro:assets.

🧠 Advanced

KeywordMeaning
Client Directiveclient:load / client:visible / client:idle / client:media / client:only.
Astro IslandsInteractive components that hydrate on the client.
Astro.fetchContent()Legacy API replaced by Content Collections.
Astro.glob()Import multiple matched files dynamically.
Astro.localsShared context in SSR.

🧰 CLI

CommandPurpose
npm create astro@latestScaffold a new project.
npm run devStart the dev server.
npm run buildBuild the site.
npm run previewPreview the build output.
astro add [integration]Install and configure an integration.

🔗 References


🪐 Summary

Astro’s “static‑first + partial hydration” approach blends performance with flexibility.
Learn these keywords to quickly understand project structure, config, and rendering logic.

Zhou Zhiou
Zhou Zhiou
Engineer · Designer

Writes about Astro, Qt, and lighting systems while building bilingual products and immersive installations.

Start a project

Related articles

Join the discussion

Powered by GitHub Discussions via Giscus.

Configure Giscus environment variables to enable comments.

PUBLIC_GISCUS_REPO="owner/name"
PUBLIC_GISCUS_REPO_ID="..."
PUBLIC_GISCUS_CATEGORY="Comments"
PUBLIC_GISCUS_CATEGORY_ID="..."