#Different layouts for pages within pages in the same level in app dir

1 messages · Page 1 of 1 (latest)

fringe martenBOT
#

Hey @granite monolith! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:

#

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:

  1. Create two route groups, groupA and groupB, inside the app directory.
  2. Create a layout.tsx file inside app/groupA and define layout A:
// app/groupA/layout.tsx
export default function LayoutA({ children }: { children: React.ReactNode }) {
  return <div className="layout-a">{children}</div>;
}
  1. Create a layout.tsx file inside app/groupB and define layout B:
// app/groupB/layout.tsx
export default function LayoutB({ children }: { children: React.ReactNode }) {
  return <div className="layout-b">{children}</div>;
}
  1. 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).

Learn how to create routes in your Next.js application.

#

@umbral mango kapa.ai is still learning and improving, please let us how it did by reacting below

calm cypress
#

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?

vague helm
#

@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?

calm cypress
#

Yes!

vague helm
#

@calm cypress cool I'll get on that tomorrow morning. To summarize:

  1. Kapa should respond to every new forum post created
  2. In the initial response it should inform users on how they can continue the discussion (i.e. by mentioning it with @)
  3. It should be conversational and keep memory within the forum post
calm cypress
#

That makes sense to me - what do you think?

vague helm
#

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