mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Format no-document-title description (#5803)
This commit is contained in:
parent
977bf8d9eb
commit
01b34bb784
|
@ -6,7 +6,7 @@ Adding `<title>` in `pages/_document.js` will lead to unexpected results with `n
|
||||||
|
|
||||||
#### Possible Ways to Fix It
|
#### Possible Ways to Fix It
|
||||||
|
|
||||||
Set `<title>` in `pages/_app.js` instead :
|
Set `<title>` in `pages/_app.js` instead:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// pages/_app.js
|
// pages/_app.js
|
||||||
|
@ -22,17 +22,20 @@ export default class MyApp extends App {
|
||||||
pageProps = await Component.getInitialProps(ctx)
|
pageProps = await Component.getInitialProps(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {pageProps}
|
return { pageProps }
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const {Component, pageProps} = this.props
|
const { Component, pageProps } = this.props
|
||||||
return <Container>
|
|
||||||
<Head>
|
return (
|
||||||
<title>My new cool app</title>
|
<Container>
|
||||||
</Head>
|
<Head>
|
||||||
<Component {...pageProps} />
|
<title>My new cool app</title>
|
||||||
</Container>
|
</Head>
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue