summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/netlify')
-rw-r--r--packages/integrations/netlify/README.md54
1 files changed, 31 insertions, 23 deletions
diff --git a/packages/integrations/netlify/README.md b/packages/integrations/netlify/README.md
index aa3ff81d8..24cc5c60c 100644
--- a/packages/integrations/netlify/README.md
+++ b/packages/integrations/netlify/README.md
@@ -25,39 +25,47 @@ If you wish to [use server-side rendering (SSR)](https://docs.astro.build/en/gui
## Installation
-First, install the `@astrojs/netlify` package using your package manager. If you're using npm or aren't sure, run this in the terminal:
-```sh
-npm install @astrojs/netlify
+Add the Netlify adapter 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.
+
+```bash
+npx astro add netlify
```
-Then, install this adapter in your `astro.config.*` file using the `adapter` property. Note: there are two different adapters, one for Netlify Functions and one for Edge Functions. See [Edge Functions](#edge-functions) below on importing the latter.
+If you prefer to install the adapter manually instead, complete the following two steps:
-__`astro.config.mjs`__
+1. Install the Netlify adapter to your project’s dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:
-```js
-import { defineConfig } from 'astro/config';
-import netlify from '@astrojs/netlify/functions';
+ ```bash
+ npm install @astrojs/netlify
+ ```
-export default defineConfig({
- output: 'server',
- adapter: netlify(),
-});
-```
+1. Add two new lines to your `astro.config.mjs` project configuration file.
+
+ ```js title="astro.config.mjs" ins={2, 5-6}
+ import { defineConfig } from 'astro/config';
+ import netlify from '@astrojs/netlify/functions';
+
+ export default defineConfig({
+ output: 'server',
+ adapter: netlify(),
+ });
+ ```
### Edge Functions
-Netlify has two serverless platforms, Netlify Functions and Netlify Edge Functions. With Edge Functions your code is distributed closer to your users, lowering latency. You can use Edge Functions by changing the import in your astro configuration file:
+Netlify has two serverless platforms, Netlify Functions and [Netlify's experimental Edge Functions](https://docs.netlify.com/netlify-labs/experimental-features/edge-functions/#app). With Edge Functions your code is distributed closer to your users, lowering latency. You can use Edge Functions by changing the `netlify/functions` import in the Astro config file to use `netlify/edge-functions`.
-```diff
-import { defineConfig } from 'astro/config';
-- import netlify from '@astrojs/netlify/functions';
-+ import netlify from '@astrojs/netlify/edge-functions';
+ ```js title="astro.config.mjs" ins={3} del={2}
+ 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(),
+ });
+ ```
-export default defineConfig({
- output: 'server',
- adapter: netlify(),
-});
-```
## Usage
[Read the full deployment guide here.](https://docs.astro.build/en/guides/deploy/netlify/)