2023-09-28 10:54:22 +00:00
|
|
|
---
|
2023-10-18 10:59:43 +00:00
|
|
|
title: 'prerenderRoutes'
|
2023-09-28 10:54:22 +00:00
|
|
|
description: prerenderRoutes hints to Nitro to prerender an additional route.
|
2023-10-18 10:59:43 +00:00
|
|
|
links:
|
|
|
|
- label: Source
|
|
|
|
icon: i-simple-icons-github
|
|
|
|
to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/ssr.ts
|
|
|
|
size: xs
|
2023-09-28 10:54:22 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
When prerendering, you can hint to Nitro to prerender additional paths, even if their URLs do not show up in the HTML of the generated page.
|
|
|
|
|
|
|
|
```js
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
prerenderRoutes('/')
|
|
|
|
prerenderRoutes(['/', '/about'])
|
|
|
|
```
|
|
|
|
|
2023-10-18 10:59:43 +00:00
|
|
|
::callout
|
2023-09-28 10:54:22 +00:00
|
|
|
In the browser, or if called outside prerendering, `prerenderRoutes` will have no effect.
|
|
|
|
::
|