Next.js Discord

Discord Forum

Issues in hiding navbar from login and register page

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
I tried to create my personal project named settlement tracker, so i completed most of my desires in my project excluding authentication. By using nextAuth and middleware , i got this as signin page. This has one flaw , that i cannot add new users, so i developed my own login and register page , In main layout , its like this <SessionProvider session={session}>
<div className=' mx-auto mt-3'>
<Navbar/>
{children}
</div>
</SessionProvider>
From this , navbar appears for my login and register page as well , as they belong to children, which i dont want , How to achieve this

2 Replies

Use route groups. You can separate the auth pages from the rest and give them a different layout.

See: https://nextjs.org/docs/app/building-your-application/routing/route-groups
Cape lionOP
thanks, i'll look towards it