mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
docs: add example on how to disable default routes for ssg (#30729)
This commit is contained in:
parent
cb7f30a1ea
commit
94ba2ea0b6
@ -126,6 +126,26 @@ This will produce three files:
|
|||||||
|
|
||||||
The `200.html` and `404.html` might be useful for the hosting provider you are using.
|
The `200.html` and `404.html` might be useful for the hosting provider you are using.
|
||||||
|
|
||||||
|
#### Skipping Client Fallback Generation
|
||||||
|
|
||||||
|
When prerendering a client-rendered app, Nuxt will generate `index.html`, `200.html` and `404.html` files by default. However, if you need to prevent any (or all) of these files from being generated in your build, you can use the `'prerender:generate'` hook from [Nitro](/docs/getting-started/prerendering#prerendergenerate-nitro-hook).
|
||||||
|
|
||||||
|
```ts twoslash [nuxt.config.ts]
|
||||||
|
export default defineNuxtConfig({
|
||||||
|
ssr: false,
|
||||||
|
nitro: {
|
||||||
|
hooks: {
|
||||||
|
'prerender:generate'(route) {
|
||||||
|
const routesToSkip = ['/index.html', '/200.html', '/404.html']
|
||||||
|
if (routesToSkip.includes(route.route)) {
|
||||||
|
route.skip = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Hybrid Rendering
|
## Hybrid Rendering
|
||||||
|
|
||||||
Hybrid rendering allows different caching rules per route using **Route Rules** and decides how the server should respond to a new request on a given URL.
|
Hybrid rendering allows different caching rules per route using **Route Rules** and decides how the server should respond to a new request on a given URL.
|
||||||
|
Loading…
Reference in New Issue
Block a user