Layout root doesn't work when using the page outside the folder
Unanswered
Reddish carpenter ant posted this in #help-forum
Reddish carpenter antOP
I have different layouts for different "folders" e.g. (web) or "auth" etc...
The issue is, the homepage, aka the root "/" is empty. So I want to make "home" inside "(web)" as the default page - however, when I do that the layout doesn't get reead from the web folder. The URL needs to be "/" and I need to have different layouts obeviously.
How can I fix this?
The issue is, the homepage, aka the root "/" is empty. So I want to make "home" inside "(web)" as the default page - however, when I do that the layout doesn't get reead from the web folder. The URL needs to be "/" and I need to have different layouts obeviously.
How can I fix this?
11 Replies
let me try to understand ur question
ur trying to set /home as your root path?
and keep the layout from (web)
if so u can just redirect from your root layout to /home
@gin if so u can just redirect from your root layout to /home
Reddish carpenter antOP
But the URL needs to be root, if you redirect its going to be /home url
Reddish carpenter antOP
I want the contents from /home that uses the (web) layout, with the url of root aka
/ - the above redirect will give url of /home 😭Well well, I suppose... not the nices solution if NextJS doesn't provide tha tout of the box, but I can do this for the index page:
import Home from "./(web)/home/page";
import WebLayout from "./(web)/layout";
function WebPage() {
return (
<WebLayout>
<Home />
</WebLayout>
)
}
export default WebPage;Lol such simple solution - but I was sleep deprive at 3-4am xd
Not sure if this is good or better more official way to do this
So if anyone has any thoughts, please let me know - I'll live this open for a day or two because it feels like there's a better way to do this but 🤷♂️