Next.js Discord

Discord Forum

next.js SSG with dynamic routing

Unanswered
Common carp posted this in #help-forum
Open in Discord
Avatar
Common carpOP
I have a file like this app/[id]/page.tsx , The purpose is that when the user enters the ID, my page can be dynamically configured.

its work when i run npm run dev , but if i run npm run build for the static file , the page is return 404.

how can i use nextjs SSG with dynamic routing ?

1 Reply

Avatar
you can use generateStaticParams to generate static paths. Like that the page will be generated during build time and should be accessable after that