M Muqiit Faturrahman
M Muqiit Faturrahman

Reputation: 129

Next.js 13 App Dir - Layouting user and admin page

Hello i have a problem to use layout using Next.js 13 Experimental App Directory. In index page or routes '/' in my website i want to display landing page and the layout for the rest of page except for admin. I have a folder structure like this :

(admin)
  studio/[[..index]]
    head.tsx
    loading.tsx
    page.tsx
  head.tsx
  page.tsx
(user)
  projects/
     page.tsx
  about/
     page.tsx
  layout.tsx
globals.css
head.tsx
layout.tsx
page.tsx
theme-provider.tsx

Can you help me, how can admin has its layout and don't using layout from root app directory?

Upvotes: 1

Views: 893

Answers (1)

Adam
Adam

Reputation: 56

The Root layout is required and must contain html and body tags. Create the layout.tsx file in the (admin) folder to add a layout for the "admin" pages.

(admin)
  studio/[[..index]]
    head.tsx
    loading.tsx
    page.tsx
  head.tsx
  page.tsx
  layout.tsx <----- NEW!!!
(user)
  projects/
     page.tsx
  about/
     page.tsx
  layout.tsx
globals.css
head.tsx
layout.tsx
page.tsx
theme-provider.tsx

Upvotes: 1

Related Questions