From a9b0c24296a76320cd81a64ebf97d7a48f1f12bd Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Thu, 28 Sep 2023 12:10:08 -0700 Subject: [PATCH 1/6] Update netlify.mdx --- src/content/docs/en/guides/deploy/netlify.mdx | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/content/docs/en/guides/deploy/netlify.mdx b/src/content/docs/en/guides/deploy/netlify.mdx index b97096558cbb2..1f73cd9c6f38e 100644 --- a/src/content/docs/en/guides/deploy/netlify.mdx +++ b/src/content/docs/en/guides/deploy/netlify.mdx @@ -4,19 +4,19 @@ 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: @@ -45,18 +45,25 @@ 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} - 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(), - }); - ``` + + :::note + In version `3.0.0` of `@astrojs/netlify`, the `@astrojs/netlify/functions` package has been enhanced to support Edge middleware directly, eliminating the need for a separate adapter for deploying your entire app to the edge. It's recommended to update your Astro configuration to leverage this enhancement. + ::: + + Below is the updated configuration snippet. In your `astro.config.mjs`, replace the import statement and update the `adapter` option as shown: + + ```js title="astro.config.mjs" ins={3, 8} del={2} + import { defineConfig } from 'astro/config'; + import netlify from '@astrojs/netlify/edge'; + import netlify from '@astrojs/netlify/functions'; + + export default defineConfig({ + output: 'server', + adapter: netlify({ + edgeMiddleware: true + }), + }); + ## How to deploy @@ -111,7 +118,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 From c9b1a52a0c4d22b4261c48be843e047957a53b6d Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Fri, 29 Sep 2023 09:07:45 -0700 Subject: [PATCH 2/6] Update src/content/docs/en/guides/deploy/netlify.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Elian ☕️ --- src/content/docs/en/guides/deploy/netlify.mdx | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/content/docs/en/guides/deploy/netlify.mdx b/src/content/docs/en/guides/deploy/netlify.mdx index 1f73cd9c6f38e..5074d94f89a48 100644 --- a/src/content/docs/en/guides/deploy/netlify.mdx +++ b/src/content/docs/en/guides/deploy/netlify.mdx @@ -52,18 +52,19 @@ If you prefer to install the adapter manually instead, complete the following tw Below is the updated configuration snippet. In your `astro.config.mjs`, replace the import statement and update the `adapter` option as shown: - ```js title="astro.config.mjs" ins={3, 8} del={2} - import { defineConfig } from 'astro/config'; - import netlify from '@astrojs/netlify/edge'; - import netlify from '@astrojs/netlify/functions'; - - export default defineConfig({ - output: 'server', - adapter: netlify({ - edgeMiddleware: true - }), - }); - + ```diff lang="js" + // astro.config.mjs + import { defineConfig } from 'astro/config'; + - import netlify from '@astrojs/netlify/edge'; + + import netlify from '@astrojs/netlify/functions'; + + export default defineConfig({ + output: 'server', + adapter: netlify({ + + edgeMiddleware: true + }), + }); + ``` ## How to deploy From 6e6436686028cd9e8a6d7058c30dc41664fdfd44 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Wed, 4 Oct 2023 09:21:34 -0700 Subject: [PATCH 3/6] Update configuration-reference.mdx --- src/content/docs/en/reference/configuration-reference.mdx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/content/docs/en/reference/configuration-reference.mdx b/src/content/docs/en/reference/configuration-reference.mdx index b000bd4af6862..27f87a72d89d5 100644 --- a/src/content/docs/en/reference/configuration-reference.mdx +++ b/src/content/docs/en/reference/configuration-reference.mdx @@ -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 component. +# Translators, please remove this note and the component. title: Configuration Reference i18nReady: true @@ -285,7 +285,7 @@ Using `'attribute'` is useful when you are manipulating the `class` attribute of **Type:** `AstroIntegration`

-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. @@ -971,5 +971,3 @@ Enable hoisted script analysis optimization by adding the experimental flag: }, } ``` - - From 7d8bbc6e714eb4a1534a3cb078bf2004ec4a5731 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Wed, 4 Oct 2023 18:06:51 -0700 Subject: [PATCH 4/6] Update src/content/docs/en/guides/deploy/netlify.mdx Co-authored-by: Sarah Rainsberger --- src/content/docs/en/guides/deploy/netlify.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/deploy/netlify.mdx b/src/content/docs/en/guides/deploy/netlify.mdx index 5074d94f89a48..9f3dd4f5df0be 100644 --- a/src/content/docs/en/guides/deploy/netlify.mdx +++ b/src/content/docs/en/guides/deploy/netlify.mdx @@ -18,7 +18,7 @@ Your Astro project is a static site by default. You don’t need any extra confi ### 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. From 8341764fcdfa25689cc6e82164bf4a96c345fcb1 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Wed, 4 Oct 2023 18:07:34 -0700 Subject: [PATCH 5/6] Update src/content/docs/en/guides/deploy/netlify.mdx Co-authored-by: Sarah Rainsberger --- src/content/docs/en/guides/deploy/netlify.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/content/docs/en/guides/deploy/netlify.mdx b/src/content/docs/en/guides/deploy/netlify.mdx index 9f3dd4f5df0be..28d93dae53f37 100644 --- a/src/content/docs/en/guides/deploy/netlify.mdx +++ b/src/content/docs/en/guides/deploy/netlify.mdx @@ -46,11 +46,7 @@ If you prefer to install the adapter manually instead, complete the following tw }); ``` - :::note - In version `3.0.0` of `@astrojs/netlify`, the `@astrojs/netlify/functions` package has been enhanced to support Edge middleware directly, eliminating the need for a separate adapter for deploying your entire app to the edge. It's recommended to update your Astro configuration to leverage this enhancement. - ::: - - Below is the updated configuration snippet. In your `astro.config.mjs`, replace the import statement and update the `adapter` option as shown: + 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 From 4e67b41eb269cd35cb8e299461fc516bd03fe236 Mon Sep 17 00:00:00 2001 From: Jacob Lamb Date: Wed, 4 Oct 2023 18:08:01 -0700 Subject: [PATCH 6/6] Update src/content/docs/en/guides/deploy/netlify.mdx Co-authored-by: Sarah Rainsberger --- src/content/docs/en/guides/deploy/netlify.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/content/docs/en/guides/deploy/netlify.mdx b/src/content/docs/en/guides/deploy/netlify.mdx index 28d93dae53f37..6df4bc5765800 100644 --- a/src/content/docs/en/guides/deploy/netlify.mdx +++ b/src/content/docs/en/guides/deploy/netlify.mdx @@ -51,8 +51,7 @@ If you prefer to install the adapter manually instead, complete the following tw ```diff lang="js" // astro.config.mjs import { defineConfig } from 'astro/config'; - - import netlify from '@astrojs/netlify/edge'; - + import netlify from '@astrojs/netlify/functions'; + import netlify from '@astrojs/netlify/functions'; export default defineConfig({ output: 'server',