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.
2024-02-21 17:09:45 +00:00
::important
2024-01-31 09:46:21 +00:00
`prerenderRoutes` can only be called within the [Nuxt context ](/docs/guide/going-further/nuxt-app#the-nuxt-context ).
::
2024-03-29 12:38:44 +00:00
::note
`prerenderRoutes` has to be executed during prerendering. If the `prerenderRoutes` is used in dynamic pages/routes which are not prerendered, then it will not be executed.
::
2023-09-28 10:54:22 +00:00
```js
const route = useRoute()
prerenderRoutes('/')
prerenderRoutes(['/', '/about'])
```
2024-02-21 17:09:45 +00:00
::note
2023-09-28 10:54:22 +00:00
In the browser, or if called outside prerendering, `prerenderRoutes` will have no effect.
::