Next.js Discord

Discord Forum

Parallel/intercept routing - no standalone view

Unanswered
DiamondHandz posted this in #help-forum
Open in Discord
Hello!

https://github.com/vercel/nextgram/tree/main - took this repo as an example

What I'm trying to accomplish: I do not want refreshing the url when viewing a modal (for example: https://nextgram.vercel.app/photos/1) to take me to the standalone photo page, but to the same page with all the photos in the background and the modal opened with card number 1 in it (and if I close the modal it goes back to all the photos page)

Not sure if it makes sense to use parallel routing / intercepting in this scenario. My main purpose is to have dynamic metadata for each photo so when it's shared the user can see the card image in the shared link.

1 Reply

Short mackerel
Yes you can absolutely do that! You just need to make sure when you close the modal or overlay, to have the router go back one element in the history.
That's exactly the use-case for parallel/intercepting routes, which was very hard to do before Nextjs.14