N
Nuxt6mo ago
spbks

how to prerender route with dynamic path segment? (like generateStaticParams in next.js)

on a route with a dynamic path segment, like pages/docs/[slugs].vue, how can i tell nuxt to prerender this route for a list of slugs, like ["get-started", "other"], and for all other slugs, display a 404 page?
3 Replies
Single
Single6mo ago
Last time i checked, you had to tell nitro about every possible value in order to pre-render. Here is a guide: https://dev.to/rafaelmagalhaes/generating-dynamic-routes-for-static-site-generation-with-nuxt-3-1epi
DEV Community
Generating Dynamic Routes for Static Site Generation with Nuxt 3
Static Site Generation (SSG) is an increasingly popular approach for building websites that combines...
spbks
spbksOP6mo ago
thanks! although it'd be cool to have something more colocated...
Single
Single6mo ago
Makes sense but to be fair, how should it know all available routes. You can ofc not pre-render dynamic pages at all and render on the client-site, with all it's downsites.
Want results from more Discord servers?
Add your server