diff --git a/errors/no-page-custom-font.md b/errors/no-page-custom-font.md index 93766e1d5d36e..51052a34422cb 100644 --- a/errors/no-page-custom-font.md +++ b/errors/no-page-custom-font.md @@ -2,7 +2,8 @@ ### Why This Error Occurred -A custom font was added to a page and not with a custom `Document`. This only adds the font to the specific page and not to the entire application. +- The custom font you're adding was added to a page - this only adds the font to the specific page and not the entire application. +- The custom font you're adding was added to a separate component within `Document` - this disables automatic font optimiztion. ### Possible Ways to Fix It @@ -35,9 +36,34 @@ class MyDocument extends Document { export default MyDocument ``` +Or as a function component: + +```js +// pages/_document.js + +import { Html, Head, Main, NextScript } from 'next/document' + +export default function Document() { + return ( + +
+ + + + +Hello world!
+