From 7eeec00a07ce7fc1c11021548326cf95943df08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ollivier?= Date: Thu, 4 May 2023 12:16:30 +0200 Subject: [PATCH 1/3] docs: selective pre-rendering options --- docs/1.getting-started/10.deployment.md | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/1.getting-started/10.deployment.md b/docs/1.getting-started/10.deployment.md index da1aeb93bda1..c547b3785e9d 100644 --- a/docs/1.getting-started/10.deployment.md +++ b/docs/1.getting-started/10.deployment.md @@ -87,7 +87,19 @@ Use the [`nuxi generate` command](/docs/api/commands/generate) to build your app npx nuxi generate ``` -### Manual Pre-rendering +Crawl-based pre-rendering can also be enabled in the `nuxt.config` file: + +```ts [nuxt.config.ts|js] +defineNuxtConfig({ + nitro: { + prerender: { + crawlLinks: true + } + } +}) +``` + +### Selective Pre-rendering You can manually specify routes that [Nitro](/docs/guide/concepts/server-engine) will fetch and pre-render during the build. @@ -101,6 +113,20 @@ defineNuxtConfig({ }) ``` +When using this option with `nuxi build`, static payloads won't be generated by default at build time. For now, selective payload generation is under an experimental flag. + +```ts [nuxt.config.ts|js] +defineNuxtConfig({ + /* The /dynamic route won't be crawled */ + nitro: { + prerender: { crawlLinks: true, ignore: ['/dynamic'] } + }, + experimental: { + payloadExtraction: true + } +}) +``` + ### Client-side Only Rendering If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `.output/public/index.html` entrypoint and JavaScript bundles like a classic client-side Vue.js application. From cde40a309b402a71657aabf0f5e398c4e0107349 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 4 May 2023 11:39:33 +0100 Subject: [PATCH 2/3] docs: improve wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Chopin --- docs/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/1.getting-started/10.deployment.md b/docs/1.getting-started/10.deployment.md index c547b3785e9d..49478344f6cd 100644 --- a/docs/1.getting-started/10.deployment.md +++ b/docs/1.getting-started/10.deployment.md @@ -87,7 +87,7 @@ Use the [`nuxi generate` command](/docs/api/commands/generate) to build your app npx nuxi generate ``` -Crawl-based pre-rendering can also be enabled in the `nuxt.config` file: +You can enable the crawl-based pre-rendering when using `nuxt build` in the `nuxt.config` file: ```ts [nuxt.config.ts|js] defineNuxtConfig({ From 0f226e294fa24c6718d47f7fd70f5ff45d0208d2 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 4 May 2023 11:43:18 +0100 Subject: [PATCH 3/3] chore: remove extra word --- docs/1.getting-started/10.deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/1.getting-started/10.deployment.md b/docs/1.getting-started/10.deployment.md index 49478344f6cd..b2cff5bf3d97 100644 --- a/docs/1.getting-started/10.deployment.md +++ b/docs/1.getting-started/10.deployment.md @@ -87,7 +87,7 @@ Use the [`nuxi generate` command](/docs/api/commands/generate) to build your app npx nuxi generate ``` -You can enable the crawl-based pre-rendering when using `nuxt build` in the `nuxt.config` file: +You can enable crawl-based pre-rendering when using `nuxt build` in the `nuxt.config` file: ```ts [nuxt.config.ts|js] defineNuxtConfig({