1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Next.js App routerで,Custom 404 pageにレイアウトを適用させない方法

Posted at

Layout.tsxは配置されているディレクトリの中身に適用される

not-found.tsxpage.tsxとで違うディレクトリにすれば良い.

→ 普通のディレクトリにいれるとルーティングされるので,論理グループを使う

app/
    (default_site)/
        /page.tsx
        about/page.tsx
        contact/page.tsx
        layout.tsx
    (error_layout)/
        layout.tsx
        not-found.tsx
components/
utils/

このように配置すればいい

参考
How to remove the Layout on 404 page

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?