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