Next.js Discord

Discord Forum

Layouts

Answered
Shaurya posted this in #help-forum
Open in Discord
Avatar
ShauryaOP
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
The Eternal Hunter
ahh, use route groups
Avatar
Ray
use route group
(with-nav)/layout.tsx <-- render Nav here
(with-nav)/page.tsx
/login/page.tsx
Avatar
The Eternal Hunter
shouldn't there be two different route gruops? (with-nav) & (without-nav)?
oh
got it
nvm
Avatar
Ray
the default one without nav lol
Avatar
ShauryaOP
can you please elaborate, didn't understand
this is my structure
Image
Avatar
The Eternal Hunter
yeah, got confused, I read it like (with-nav)/page.tsx/login/page.tsx instead of seperate lines
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
The Eternal Hunter
checkout docs here
Avatar
ShauryaOP
so the home page /app/page.tsx would be /app/withnav/page.tsx right?
oh
the parentheses
got it, lemme do that
Avatar
The Eternal Hunter
yeah, like this 👇
Image
Avatar
ShauryaOP
thanks, works perfect, didn't have use of routing groups before