Type something to search...

Blog

How to protect routes in Astro with middleware?

How to protect routes in Astro with middleware?

To protect routes in Astro with middleware, create src/middleware.ts and export an onRequest handler that does two jobs: it loads the current

Dive Deeper
How to query and sort content collections in Astro?

How to query and sort content collections in Astro?

To query a content collection in Astro, call getCollection("name") from astro:content to get every entry as an array, or **`getEntry("name",

Dive Deeper
How to use React components in Astro?

How to use React components in Astro?

To use React components in Astro, install the official @astrojs/react integration with npx astro add react, then import your .jsx or .tsx c

Dive Deeper
How to calculate reading time for Astro blog posts?

How to calculate reading time for Astro blog posts?

To calculate reading time for Astro blog posts, count the words in each post and divide by an average reading speed, usually around 200 words per min

Dive Deeper
How to set up redirects in Astro?

How to set up redirects in Astro?

To set up redirects in Astro, add a redirects object to astro.config.mjs that maps old paths to new ones, such as "/old-about": "/about". Tha

Dive Deeper
How to reduce JavaScript bundle size in Astro?

How to reduce JavaScript bundle size in Astro?

To reduce JavaScript bundle size in Astro, ship fewer and smaller islands. Every component with a client:* directive sends its framework runtim

Dive Deeper