Next.js Discord

Discord Forum

Layouts

Answered
Shaurya posted this in #help-forum
Open in Discord
Avatar
I have a layout which have nav and stuff but I don't want the layout to the login page, how would I do that?

18 Replies

Avatar
ahh, use route groups
Avatar
@Shaurya I have a layout which have nav and stuff but I don't want the layout to the login page, how would I do that?
Avatar
use route group
(with-nav)/layout.tsx <-- render Nav here
(with-nav)/page.tsx
/login/page.tsx
Avatar
@Ray use route group (with-nav)/layout.tsx <-- render Nav here (with-nav)/page.tsx /login/page.tsx
Avatar
shouldn't there be two different route gruops? (with-nav) & (without-nav)?
oh
got it
nvm
Avatar
can you please elaborate, didn't understand
this is my structure
Image
Avatar
@Ray the default one without nav lol
Avatar
yeah, got confused, I read it like (with-nav)/page.tsx/login/page.tsx instead of seperate lines
Avatar
@Shaurya can you please elaborate, didn't understand this is my structure
Avatar
create a folder named (with-nav), and in that keep your pages with nav bar, and layout with navbar, and outside of that folder keep other pages without those nav bar.
Answer
Avatar
checkout docs here
oh
the parentheses
got it, lemme do that
Avatar
yeah, like this 👇
Image
Avatar
thanks, works perfect, didn't have use of routing groups before