Skip to content

Commit 1f43586

Browse files
committed
Add Google AdSense script to _document.tsx file
1 parent 5294a7c commit 1f43586

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

Ads.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

pages/_document.tsx

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
1-
import Document, { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
1+
import Document, {
2+
Html,
3+
Head,
4+
Main,
5+
NextScript,
6+
DocumentContext,
7+
} from "next/document";
28

39
class MyDocument extends Document {
4-
static async getInitialProps(ctx: DocumentContext) {
5-
const initialProps = await Document.getInitialProps(ctx)
6-
return { ...initialProps }
7-
}
10+
static async getInitialProps(ctx: DocumentContext) {
11+
const initialProps = await Document.getInitialProps(ctx);
12+
return { ...initialProps };
13+
}
814

9-
render() {
10-
return (
11-
<Html>
12-
<Head>
13-
<link href="https://fonts.googleapis.com/css2?family=Ysabeau+Infant:wght@300&display=swap" rel="stylesheet" />
14-
</Head>
15-
<body>
16-
<Main />
17-
<NextScript />
18-
</body>
19-
</Html>
20-
)
21-
}
15+
render() {
16+
return (
17+
<Html>
18+
<Head>
19+
<link
20+
href="https://fonts.googleapis.com/css2?family=Ysabeau+Infant:wght@300&display=swap"
21+
rel="stylesheet"
22+
/>
23+
<script
24+
async
25+
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9765110233243602"
26+
crossOrigin="anonymous"
27+
></script>
28+
</Head>
29+
<body>
30+
<Main />
31+
<NextScript />
32+
</body>
33+
</Html>
34+
);
35+
}
2236
}
2337

24-
export default MyDocument
38+
export default MyDocument;

0 commit comments

Comments
 (0)