Last active
July 30, 2020 19:29
-
-
Save MaxMEllon/022d1679c9772b6e80c887e67d172375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class MyDocument extends Document<{ tracking?: boolean; nonce: string }> { | |
static async getInitialProps(ctx: DocumentContext) { | |
const initialProps = await Document.getInitialProps(ctx) | |
const dnt = ctx?.req?.headers['DNT'] ?? '0' | |
const tracking = dnt !== '1' | |
return { ...initialProps, tracking, nonce } | |
} | |
render() { | |
return ( | |
<html lang="ja"> | |
<Head> | |
<link rel="manifest" href="/manifest.json" /> | |
<meta name="theme-color" content={colors.brand} /> | |
<meta name="description" content="令和2年度補正家賃支援給付金事務事業" /> | |
{this.props.tracking && <script src={analyticsScript} async />} | |
</Head> | |
<body> | |
<Main /> | |
<NextScript nonce={this.props.nonce} /> | |
</body> | |
</html> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment