I am trying to migrate my project from Next v12 to Next v13 app directory and I am not sure where to put the link
tags in the newer version. In v12 they are placed in the Head
component in my _document.js
file like this:
<Head>
{/* Static Css File */}
<link rel="stylesheet" href={`${process.env.NODE_ENV === 'production' ? process.env.NEXT_PUBLIC_BASEPATH ?? '' : ''}/css/fontawesome-all.min.css`} />
<link rel="stylesheet" href={`${process.env.NODE_ENV === 'production' ? process.env.NEXT_PUBLIC_BASEPATH ?? '' : ''}/css/iconfont.css`} />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true" />
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800&family=Roboto:ital,wght@0,300;0,400;0,500;0,700;0,900;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet" />
</Head>
where and how should I use them in my next 13 app dir app?
2
Answers
You can use app/layout.tsx.
Here is an example that will help you.
Next has layout.js file inside app directory
as shown below inside head tag you can place your links