#Different layouts for pages within pages in the same level in app dir
1 messages · Page 1 of 1 (latest)
Yes, you can achieve this by using nested layouts and route groups. First, create two separate route groups for the pages that will use layout A and layout B. Then, create a layout.tsx file inside each route group, defining the respective layouts.
Here's an example:
- Create two route groups,
groupAandgroupB, inside theappdirectory. - Create a
layout.tsxfile insideapp/groupAand define layout A:
// app/groupA/layout.tsx
export default function LayoutA({ children }: { children: React.ReactNode }) {
return <div className="layout-a">{children}</div>;
}
- Create a
layout.tsxfile insideapp/groupBand define layout B:
// app/groupB/layout.tsx
export default function LayoutB({ children }: { children: React.ReactNode }) {
return <div className="layout-b">{children}</div>;
}
- Place your pages inside the respective route groups, and they will use the corresponding layouts.
For more information on route groups, refer to the Next.js documentation on defining routes (https://beta.nextjs.org/docs/routing/defining-routes#route-groups).
@umbral mango kapa.ai is still learning and improving, please let us how it did by reacting below
Close 😃 Missing the paranthesis around the route group, e.g. app/(group)/ etc
You need to mention it I believe
@fringe marten doesn't the route group have parenthesis in the file name?
@calm cypress kapa is currently running in "forum" mode where it will respond to every new forum post but doesn't allow for follow up questions. Would you like it to be able to handle follow up questions in the forum threads?
Yes!
@calm cypress cool I'll get on that tomorrow morning. To summarize:
- Kapa should respond to every new forum post created
- In the initial response it should inform users on how they can continue the discussion (i.e. by mentioning it with @)
- It should be conversational and keep memory within the forum post
That makes sense to me - what do you think?
Yes I think that is better as well. We can try it like this and then iterate on it as you observe user behaviour. I will give you a ping once it is ready