Unverified Commit 914df17a authored by Kahfi Elhady's avatar Kahfi Elhady Committed by GitHub

docs: remove incorrect _document.tsx font example (#91346)

saw the issue about the _document.tsx example not working. next/font
cant be used in _document.tsx, it throws an error. removed that section
from the docs since _app.tsx already has the correct example.

fixes #88832
Co-authored-by: 's avatarKahfi Elhady <kahfie@gmail.com>
Co-authored-by: 's avatarJoseph <joseph.chamochumbi@vercel.com>
parent cf4d3ae8
...@@ -89,50 +89,6 @@ export default function MyApp({ Component, pageProps }) { ...@@ -89,50 +89,6 @@ export default function MyApp({ Component, pageProps }) {
} }
``` ```
If you want to apply the font to the `<html>` element, you can use a [Custom Document](/docs/pages/building-your-application/routing/custom-document) (`pages/_document`):
```tsx filename="pages/_document.tsx" highlight={2,4-6,10} switcher
import { Html, Head, Main, NextScript } from 'next/document'
import { Geist } from 'next/font/google'
const geist = Geist({
subsets: ['latin'],
})
export default function Document() {
return (
<Html lang="en" className={geist.className}>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
```
```jsx filename="pages/_document.js" highlight={2,4-6,10} switcher
import { Html, Head, Main, NextScript } from 'next/document'
import { Geist } from 'next/font/google'
const geist = Geist({
subsets: ['latin'],
})
export default function Document() {
return (
<Html lang="en" className={geist.className}>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
```
</PagesOnly> </PagesOnly>
## Google fonts ## Google fonts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment