generateStaticParams in modals with Intercepted and Parallel Routes.
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
Hi everyone, I'm currently working on a portfolio page featuring a list of projects on the front page. When a user clicks on a project, it opens in a modal, and the browser URL changes to the project URL for easy sharing.
I've successfully generated static parameters for the individual project pages as follows:
markdown
Copy code
app
- projects
-- [project]
--- page.tsx
Running npm run build converts these projects into static pages.
However, I'm facing challenges with implementing the same approach for modal pages. Here's the structure I've attempted:
markdown
Copy code
app
- @modal
-- (.)projects
--- [project]
---- page.tsx
Unfortunately, when I build my project, the routes for these pages remain dynamic.
So, my question is whether what I'm attempting is even possible. If it is, could someone please point me in the right direction?
I've successfully generated static parameters for the individual project pages as follows:
markdown
Copy code
app
- projects
-- [project]
--- page.tsx
Running npm run build converts these projects into static pages.
However, I'm facing challenges with implementing the same approach for modal pages. Here's the structure I've attempted:
markdown
Copy code
app
- @modal
-- (.)projects
--- [project]
---- page.tsx
Unfortunately, when I build my project, the routes for these pages remain dynamic.
So, my question is whether what I'm attempting is even possible. If it is, could someone please point me in the right direction?
10 Replies
@Ray do you mean you cannot get `/projects/[project]/page.tsx` static generated?
Sloth bearOP
I can get this static generated:
/projects/[project]/page.tsx
I can't get this static generated:
/@modal/(.)projects/[project]/page.tsx
So the pages that are opened in the modal are not static generated
/projects/[project]/page.tsx
I can't get this static generated:
/@modal/(.)projects/[project]/page.tsx
So the pages that are opened in the modal are not static generated
@Sloth bear I can get this static generated:
/projects/[project]/page.tsx
I can't get this static generated:
/@modal/(.)projects/[project]/page.tsx
So the pages that are opened in the modal are not static generated
how do you know they are not static generated? I think you only need
generateStaticParams on /projects/[project]/page.tsxSloth bearOP
I run npm run build and it tells me in the build log
@Sloth bear I run npm run build and it tells me in the build log
could you show a screenshot of it?
Sloth bearOP
@Ray could you show a screenshot of it?
Sloth bearOP
like the green ones are the correctly generated ones and the red ones are what I would like to generate static
@Ray oh there is an issue for this
https://github.com/vercel/next.js/issues/52842
Sloth bearOP
awesome! thank you very much for your help and your time. I'll give it a shot
@Sloth bear awesome! thank you very much for your help and your time. I'll give it a shot
https://github.com/vercel/next.js/issues/52842#issuecomment-1885763985
maybe you could provide a minimal reproduction for him
maybe you could provide a minimal reproduction for him