/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
errors/no-document-title.mdx
33 строки
723 B
Delba de Oliveira
Unify caching story across the docs (#90149)
03 мар 2026, 16:14
Не верифицирован
03 мар 2026, 16:14
c2b4c08
Код
Авторство
О чём код?
--- title: '`<title>` should not be used in _document.js `<Head>`' --- ## Why This Error Occurred Adding `<title>` in `pages/_document.js` will lead to unexpected results with `next/head` since `_document.js` is only rendered on the initial prerender. ## Possible Ways to Fix It Set `<title>` in `pages/_app.js` instead: ```jsx filename="pages/_app.js" import React from 'react' import Head from 'next/head' function MyApp({ Component, pageProps }) { return ( <> <Head> <title>My new cool app</title> </Head> <Component {...pageProps} /> </> ) } export default MyApp ``` ## Useful Links - [The issue this was reported in: #4596](https://github.com/vercel/next.js/issues/4596)