最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to add custom document in nextJs 13 - Stack Overflow

programmeradmin0浏览0评论

I want to create a custom document for my new nextjs 13 project and use custom design system package. The package requires custom documents in the page directory as the nextjs official doc guided. However, there is no documents for custom document in app directory structure in nextjs 13.

I want to create a custom document for my new nextjs 13 project and use custom design system package. The package requires custom documents in the page directory as the nextjs official doc guided. However, there is no documents for custom document in app directory structure in nextjs 13.

Share Improve this question asked Aug 21, 2023 at 12:46 SkySky 4021 gold badge6 silver badges15 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 7

You can create a app/layout.tsx (which is called root layout) if you are using app router.

The root layout replaces the _app.js and _document.js files from pages router.

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  )
}

The root layout is defined at the top level of the app directory and applies to all routes. This layout enables you to modify the initial HTML returned from the server.

https://nextjs/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required

If you are not using TypeScript, you can use the name: app/layout.js.

发布评论

评论列表(0)

  1. 暂无评论