Next.js Discord

Discord Forum

hydration error

Answered
Vizsla posted this in #help-forum
Open in Discord
Original message was deleted.
Answered by fuma
Why /dashboard also contains a html tag? If you want the layouts to be different, you can use [route groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups).

Therefore, your project structure will be like:

layout.tsx: Root layout, contains providers and html tag
(home)/layout.tsx: Layout of pages under (home), including a navbar/links
(home)/page.tsx: The home page at /
(home)/about.tsx: The about page at /about
(dashboard)/dashboard/layout.tsx: Layout of pages under (dashboard)
(dashboard)/dashboard/page.tsx: The dashboard page at /dashboard
View full answer

33 Replies

Can you provide some code or a GitHub repo?
Vizsla
sure
Vizsla
wait i forgot to git push
ok there
it only shows when you go to /dashboard
@fuma
i wanted the layout to be different for /dashboard
Why /dashboard also contains a html tag? If you want the layouts to be different, you can use [route groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups).

Therefore, your project structure will be like:

layout.tsx: Root layout, contains providers and html tag
(home)/layout.tsx: Layout of pages under (home), including a navbar/links
(home)/page.tsx: The home page at /
(home)/about.tsx: The about page at /about
(dashboard)/dashboard/layout.tsx: Layout of pages under (dashboard)
(dashboard)/dashboard/page.tsx: The dashboard page at /dashboard
Answer
Vizsla
Ohhh
Your layouts will be nested, which means the same page contains multiple html tags.
that's why you got the error
@fuma Your layouts will be nested, which means the same page contains multiple html tags.
Vizsla
it works but how do i make /dashboard not show the navbar instead i want it to show the sidebar
Add the sidebar to your dashboard layout
Vizsla
some reason it still shows the navbar
Vizsla
do i remove the html and body tag?
Remove these tags from where?
Vizsla
Nevermind
No layouts other than (home)/layout.tsx includes the navbar
(dashboard)/layout.tsx is where you put the sidebar
Read [Route Groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups) for further information
Vizsla
so do i keep the navbar where it is?
im new to next js
Vizsla
hhhh
ohhh
i get it now
so i create a folder in the app folder name home
and add layout.js
it's a route group, you have to wrap the folder name in parenthesis, read the docs above
i got it now