Skip to content
Merged
27 changes: 15 additions & 12 deletions src/content/docs/en/guides/deploy/netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ description: How to deploy your Astro site to the web on Netlify.
type: deploy
i18nReady: true
---
[Netlify](https://netlify.com) offers hosting and serverless backend services for web applications and static websites. Any Astro site can be hosted on Netlify!
[Netlify](https://netlify.com) offers hosting and serverless backend services for web applications and static websites. Any Astro site can be hosted on Netlify!

This guide includes instructions for deploying to Netlify through the website UI or Netlify's CLI.

## Project Configuration

Your Astro project can be deployed to Netlify in three different ways: as a static site, a server-rendered site, or an (experimental) edge-rendered site.
Your Astro project can be deployed to Netlify in three different ways: as a static site, a server-rendered site, or an edge-rendered site.

### Static Site

Your Astro project is a static site by default. You don’t need any extra configuration to deploy a static Astro site to Netlify.
Your Astro project is a static site by default. You don’t need any extra configuration to deploy a static Astro site to Netlify.

### Adapter for SSR/Edge
### Adapter for SSR

To enable SSR in your Astro project and deploy on Netlify:
To enable SSR in your Astro project and deploy on Netlify, including using Netlify's edge functions:

Add [the Netlify adapter](/en/guides/integrations-guide/netlify/) to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.

Expand All @@ -45,18 +45,21 @@ If you prefer to install the adapter manually instead, complete the following tw
adapter: netlify(),
});
```

To render your project using [Netlify's experimental Edge Functions](https://docs.netlify.com/netlify-labs/experimental-features/edge-functions/#app) instead, change the `netlify/functions` import in the Astro config file to use `netlify/edge-functions`.
```js title="astro.config.mjs" ins={3} del={2}

You can also deploy your project using Netlify's Edge Functions by adding `edgeMiddleware: true` to the Netlify adatper's configuration:

```diff lang="js"
// astro.config.mjs
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
import netlify from '@astrojs/netlify/edge-functions';

export default defineConfig({
output: 'server',
adapter: netlify(),
adapter: netlify({
+ edgeMiddleware: true
}),
});
```
```

## How to deploy

Expand Down Expand Up @@ -111,7 +114,7 @@ You can also create a new site on Netlify and link up your Git repository by ins
3. Run `netlify init` and follow the instructions
4. Confirm your build command (`astro build`)

The CLI will automatically detect the build settings (`astro build`) and deploy directory (`dist`), and will offer to automatically generate [a `netlify.toml` file](#netlifytoml-file) with those settings.
The CLI will automatically detect the build settings (`astro build`) and deploy directory (`dist`), and will offer to automatically generate [a `netlify.toml` file](#netlifytoml-file) with those settings.

5. Build and deploy by pushing to Git

Expand Down
6 changes: 2 additions & 4 deletions src/content/docs/en/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# NOTE: This file is auto-generated from 'scripts/docgen.mjs'
# Do not make edits to it directly, they will be overwritten.
# Instead, change this file: https://github.com/withastro/astro/blob/main/packages/astro/src/%40types/astro.ts
# Translators, please remove this note and the <DontEditWarning/> component.
# Translators, please remove this note and the <DontEditWarning/> component.

title: Configuration Reference
i18nReady: true
Expand Down Expand Up @@ -285,7 +285,7 @@ Using `'attribute'` is useful when you are manipulating the `class` attribute of
**Type:** `AstroIntegration`
</p>

Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters for [Netlify](/en/guides/deploy/netlify/#adapter-for-ssredge), [Vercel](/en/guides/deploy/vercel/#adapter-for-ssr), and more to engage Astro SSR.
Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters for [Netlify](/en/guides/deploy/netlify/#adapter-for-ssr), [Vercel](/en/guides/deploy/vercel/#adapter-for-ssr), and more to engage Astro SSR.

[See our Server-side Rendering guide](/en/guides/server-side-rendering/) for more on SSR, and [our deployment guides](/en/guides/deploy/) for a complete list of hosts.

Expand Down Expand Up @@ -971,5 +971,3 @@ Enable hoisted script analysis optimization by adding the experimental flag:
},
}
```