-
Notifications
You must be signed in to change notification settings - Fork 382
/
Copy path_document.tsx
97 lines (88 loc) · 2.76 KB
/
_document.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import Document, { Html, Head, Main, NextScript } from "next/document";
import { ServerStyleSheet } from "styled-components";
export default class MyDocument extends Document {
static async getInitialProps(ctx) {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;
try {
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => (props) =>
sheet.collectStyles(<App {...props} />),
});
const initialProps = await Document.getInitialProps(ctx);
return {
...initialProps,
styles: (
<>
{initialProps.styles}
{sheet.getStyleElement()}
</>
),
};
} finally {
sheet.seal();
}
}
render() {
return (
<Html>
<Head>
<meta
name="viewport"
content="initial-scale=1.0, width=device-width"
/>
<link rel="icon" href="/projectlearn.png" type="image/x-icon" />
<meta name="author" content="Nilarjun Das" />
<link rel="apple-touch-icon" href="/projectlearn.png" />
<link
rel="preload"
href="/fonts/Lato-Bold.ttf"
as="font"
crossOrigin=""
/>
<link
rel="preload"
href="/fonts/Lato-Regular.ttf"
as="font"
crossOrigin=""
/>
<script
async={true}
src="https://app.appzi.io/bootstrap/bundle.js?token=OQNTh"
/>
<script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2095098316338345"
crossOrigin="anonymous"
></script>
{/* Google Tag Manager */}
<script
dangerouslySetInnerHTML={{
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P9CT8SN8');`,
}}
/>
{/* End Google Tag Manager */}
</Head>
<body>
<Main />
<NextScript />
{/* Google Tag Manager (noscript) */}
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-P9CT8SN8"
height="0"
width="0"
style={{ display: "none", visibility: "hidden" }}
></iframe>
</noscript>
{/* End Google Tag Manager (noscript) */}
</body>
</Html>
);
}
}