@nuxt/docs-nightly 5.0.0-29676109.a0871083 → 5.0.0-29677644.cbbf2682
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -80,6 +80,25 @@ There are two ways to deploy a Nuxt application to any static hosting services:
|
|
|
80
80
|
- Static site generation (SSG) with `ssr: true` pre-renders routes of your application at build time. (This is the default behavior when running `nuxt generate`.) It will also generate `/200.html` and `/404.html` single-page app fallback pages, which can render dynamic routes or 404 errors on the client (though you may need to configure this on your static host).
|
|
81
81
|
- Alternatively, you can prerender your site with `ssr: false` (static single-page app). This will produce HTML pages with an empty `<div id="__nuxt"></div>` where your Vue app would normally be rendered. You will lose many SEO benefits of prerendering your site, so it is suggested instead to use [`<ClientOnly>`](/docs/4.x/api/components/client-only) to wrap the portions of your site that cannot be server rendered (if any).
|
|
82
82
|
|
|
83
|
+
### Static Fallback Pages
|
|
84
|
+
|
|
85
|
+
Nuxt can generate two fallback pages for static hosts:
|
|
86
|
+
|
|
87
|
+
- `200.html` is the single-page app fallback. Configure your host to serve it for unmatched routes when you want client-side routing to handle the URL.
|
|
88
|
+
- `404.html` is the not-found fallback. Configure your host to serve it for routes that should keep a 404 status.
|
|
89
|
+
|
|
90
|
+
`nuxt generate` and `nuxt build --prerender` generate these files automatically. If you use `nuxt build` with route rules to prerender selected routes, add the fallback page explicitly:
|
|
91
|
+
|
|
92
|
+
```ts twoslash [nuxt.config.ts]
|
|
93
|
+
export default defineNuxtConfig({
|
|
94
|
+
routeRules: {
|
|
95
|
+
'/200.html': { prerender: true },
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Some providers use `200.html`, some use `404.html`, and some let you configure both. Check your hosting provider's static fallback or rewrite settings after deployment.
|
|
101
|
+
|
|
83
102
|
:read-more{title="Nuxt prerendering" to="/docs/4.x/getting-started/prerendering"}
|
|
84
103
|
|
|
85
104
|
### Client-side Only Rendering
|
|
@@ -124,7 +124,7 @@ This will produce three files:
|
|
|
124
124
|
- `200.html`
|
|
125
125
|
- `404.html`
|
|
126
126
|
|
|
127
|
-
The `200.html`
|
|
127
|
+
The `200.html` file is intended for static hosts that need a success-status fallback for client-side routing. The `404.html` file is intended for static hosts that serve a not-found page while preserving a 404 status. Which file you should use depends on your hosting provider's fallback or rewrite settings.
|
|
128
128
|
|
|
129
129
|
#### Skipping Client Fallback Generation
|
|
130
130
|
|