Layout for home page (index) in App router
Answered
Asian black bear posted this in #help-forum
Asian black bearOP
How to create a layout which is exclusive for home page only?
As far as I understand the file
As far as I understand the file
layout.ts inside app directory is the root layout for all routes in the app. But the root of the app directory is also the directory of the homepage at the same time so I can't create there another layout.ts which is only for the home page. I need to create some custom file and import in inside homepage?4 Replies
why do you need a layout but only for the root? can't you just put that code in the page file?
@riský why do you need a layout but only for the root? can't you just put that code in the page file?
Asian black bearOP
Actually you are right, I don't know what I was thinking.
I think the issue is different for me. I don't like that homepage is root at the same time. I would like to store my page components in the same folder as
I think the issue is different for me. I don't like that homepage is root at the same time. I would like to store my page components in the same folder as
page.tsx file but it feels weird when it's the root and it contains so many files. I guess it's not possible to create "home" directory which would work like an index?you can use route groups to have a "folder" for it then
Answer
Asian black bearOP
Okay, thank