Next.js Discord

Discord Forum

Layout for Routes

Unanswered
Dogo Argentino posted this in #help-forum
Open in Discord
Dogo ArgentinoOP
Yo
I want to have following routing for my next js application

-/ (This will be more like a landing page serves no purpose than to direct to dashboard with button)
|-/dashboard
|-/dashboard/layout.tsx ?
|-/profile
|-/profile/layout.tsx ?
|-/settings
|-/settings/layout.tsx ?
|-rootlayout.tsx

So I have a root layout for "/"
then for others I want another layout which would consist of sidebar
would I have to create layout for each route ....doesnt serve the purpose of layout though if i have to do it multiple times

Or one thing I could think of is
when ever I get req of "/" root layout should render landing page
and when other paths then root layout will render with sidebar

5 Replies

though is the other thing possible ?
to render like if else ? in layout
Maybe never tried it tbh.