Permalink
Newer
100644
79 lines (74 sloc)
2.11 KB
12
<Head>
13
<title>My page</title>
14
<meta charSet="utf-8" />
15
{/* Use minimum-scale=1 to enable GPU rasterization */}
16
<meta
17
name="viewport"
18
content={
19
'user-scalable=0, initial-scale=1, ' +
20
'minimum-scale=1, width=device-width, height=device-height'
21
}
22
/>
23
{/*
24
manifest.json provides metadata used when your web app is added to the
25
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
26
*/}
27
<link rel="manifest" href="/static/manifest.json" />
28
{/* PWA primary color */}
29
<meta name="theme-color" content={context.theme.palette.primary[500]} />
30
<link
31
rel="stylesheet"
32
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
33
/>
34
</Head>
35
<body>
36
<Main />
37
<NextScript />
38
</body>
39
</html>
40
);
41
}
42
}
43
44
MyDocument.getInitialProps = ctx => {
45
// Resolution order
46
//
47
// On the server:
48
// 1. page.getInitialProps
49
// 2. document.getInitialProps
50
// 3. page.render
51
// 4. document.render
52
//
53
// On the server with error:
54
// 2. document.getInitialProps
55
// 3. page.render
56
// 4. document.render
57
//
58
// On the client
59
// 1. page.getInitialProps
60
// 3. page.render
61
62
// Reset the context for handling a new request.
63
setContext();
64
const page = ctx.renderPage();
65
// Get the context with the collected side effects.
66
const context = getContext();
67
return {
68
...page,
69
styles: (
70
<style
71
id="jss-server-side"
72
// eslint-disable-next-line react/no-danger
73
dangerouslySetInnerHTML={{ __html: context.sheetsRegistry.toString() }}
74
/>
75
),
76
};
77
};
78
79
export default MyDocument;