Blog

How to use client:only for browser-only components in Astro?
To use client:only in Astro, add it to a framework component and pass the name of the component's framework as its value, for example `<Chart cli
Dive Deeper
How to reference one collection from another in Astro?
To reference one collection from another in Astro, use the reference() function from astro:content in your collection schema. For example, `a
Dive Deeper
How to define a content collection schema with Zod in Astro?
To define a content collection schema with Zod in Astro, import z from astro/zod and pass a z.object({...}) as the schema property of `de
Dive Deeper
How to pass props to an Astro component?
To pass props to an Astro component, write them as attributes when you use the component, such as <Greeting name="Sajjad" />, and read them inside
Dive Deeper
What is the component script (frontmatter) in an Astro component?
The component script is the block of JavaScript or TypeScript between the two --- fences at the top of an .astro file. People often call it t
Dive Deeper
How to use conditional rendering in Astro templates?
To use conditional rendering in an Astro template, write a JavaScript expression in curly braces that evaluates to markup or to nothing. The two
Dive Deeper