Blog

How to build a custom Astro integration?
To build a custom Astro integration, write a function that returns an object with a name and a hooks object, then add a call to that function
Dive Deeper
How to add dark mode to an Astro site?
To add dark mode to an Astro site, define your colours as CSS custom properties, give them dark values inside a prefers-color-scheme: dark medi
Dive Deeper
How to connect Astro to a database?
To connect Astro to a database, install a database client in your project, create the connection once in a module such as src/db/index.ts, and
Dive Deeper
How to pass CSS variables from frontmatter with define:vars in Astro?
To pass CSS variables from frontmatter in Astro, add the define:vars directive to a component's <style> tag and give it an object of values: `<
Dive Deeper
How to create dynamic routes with getStaticPaths in Astro?
To create a dynamic route in Astro, name a page file with a parameter in square brackets, such as src/pages/blog/[id].astro, and export a **getStat
Dive Deeper
How to use astro:env for type-safe environment variables?
To use astro:env, declare your environment variables in the env.schema option of astro.config.mjs using the envField helpers, givin
Dive Deeper