Permalink
Newer
100644
125 lines (117 sloc)
4.1 KB
1
import React from 'react';
2
import Document, { Head, Main, NextScript } from 'next/document';
16
<meta
17
name="description"
18
content="React Components that Implement Google's Material Design."
19
/>
20
{/* Use minimum-scale=1 to enable GPU rasterization */}
21
<meta
22
name="viewport"
23
content={
24
'user-scalable=0, initial-scale=1, ' +
25
'minimum-scale=1, width=device-width, height=device-height'
26
}
27
/>
28
{/*
29
manifest.json provides metadata used when your web app is added to the
30
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
31
*/}
32
<link rel="manifest" href="/static/manifest.json" />
33
{/* PWA primary color */}
35
<link
36
rel="stylesheet"
37
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
38
/>
42
<meta name="twitter:site" content="@MaterialUI" />
43
<meta name="twitter:title" content="Material-UI" />
44
<meta
45
name="twitter:description"
46
content="React Components that Implement Google's Material Design."
48
<meta name="twitter:image" content="https://material-ui-next.com/static/brand.png" />
49
{/* Facebook */}
50
<meta property="og:type" content="website" />
51
<meta property="og:title" content="Material-UI" />
52
<meta
53
property="og:description"
54
content="React Components that Implement Google's Material Design."
55
/>
63
{/* Global Site Tag (gtag.js) - Google Analytics */}
64
<script async src={`https://www.googletagmanager.com/gtag/js?id=${config.google.id}`} />
65
<script
66
// eslint-disable-next-line react/no-danger
67
dangerouslySetInnerHTML={{
68
__html: `
69
window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments)};
70
gtag('js', new Date());
71
`,
72
}}
73
/>
76
</body>
77
</html>
78
);
79
}
80
}
81
82
MyDocument.getInitialProps = ctx => {
83
// Resolution order
84
//
85
// On the server:
86
// 1. page.getInitialProps
87
// 2. document.getInitialProps
88
// 3. page.render
89
// 4. document.render
90
//
91
// On the server with error:
92
// 2. document.getInitialProps
93
// 3. page.render
94
// 4. document.render
95
//
96
// On the client
97
// 1. page.getInitialProps
98
// 3. page.render
99
100
// Get the context of the page to collected side effects.
101
const pageContext = getPageContext();
107
if (process.env.NODE_ENV === 'production') {
108
css = cleanCSS.minify(css).styles;
109
}
110
115
styles: (
116
<style
117
id="jss-server-side"
118
// eslint-disable-next-line react/no-danger