Create a subdirectory under /app that still gets rendered on the root URL. Is that possible?
Answered
Laysan Albatross posted this in #help-forum
Laysan AlbatrossOP
├── home
│ └── page.tsx
by default, this page can be accessed with rooturl/home
but it would be great if it's possible to keep the file where it is but render it directly with rooturl
│ └── page.tsx
by default, this page can be accessed with rooturl/home
but it would be great if it's possible to keep the file where it is but render it directly with rooturl
11 Replies
Use route groups like app/(group1)/(group2)/page.tsx then it’ll still be in /
Laysan AlbatrossOP
you mean app/directory1/directory2/page.tsx? Because that would lead to the content being available on baseurl/directory1/directory2/page.tsx, doesn't it?
Or only when the directory contains a page.tsx? Is that the key difference?
Route groups. With the ( )
Answer
Read the route group docs for more information
Laysan AlbatrossOP
so name the directory with ()
yesss thank you so much.
Laysan AlbatrossOP
So I know should have the possibility to render page.tsx on the rooturl, but use a completely independent layout file for it. At least that's what I hope.
Laysan AlbatrossOP
okay no. ^^ no matter where I put it, it's still a child of the RootLayout. (obviously)
fck it, I'll find a way.