Nuxt/docs/3.api/3.utils/prerender-routes.md

919 B

title description links
prerenderRoutes prerenderRoutes hints to Nitro to prerender an additional route.
label icon to size
Source i-simple-icons-github https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/ssr.ts xs

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.

::important prerenderRoutes can only be called within the Nuxt context. ::

::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. ::

const route = useRoute()

prerenderRoutes('/')
prerenderRoutes(['/', '/about'])

::note In the browser, or if called outside prerendering, prerenderRoutes will have no effect. ::