File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11import { Html , Head , Main , NextScript } from "next/document" ;
2+ import Script from "next/script" ;
23
34const modeScript = `
45 let darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
@@ -55,6 +56,10 @@ const faviconScript = `
5556 onUpdate();
5657` ;
5758
59+ const adSenseScript = `
60+ (adsbygoogle = (window.adsbygoogle || [])).push({});
61+ ` ;
62+
5863export default function Document ( ) {
5964 return (
6065 < Html lang = "en" >
@@ -75,6 +80,18 @@ export default function Document() {
7580 />
7681 < script dangerouslySetInnerHTML = { { __html : modeScript } } />
7782 < script dangerouslySetInnerHTML = { { __html : faviconScript } } />
83+ < script
84+ async
85+ src = { `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-${ process . env . NEXT_PUBLIC_ADSENSE_ID } ` }
86+ > </ script >
87+ < script dangerouslySetInnerHTML = { { __html : adSenseScript } } />
88+ < ins
89+ className = "adsbygoogle"
90+ style = { { display : "block" } }
91+ data-ad-client = { `ca-pub-${ process . env . NEXT_PUBLIC_ADSENSE_ID } ` }
92+ data-ad-slot = { `${ process . env . NEXT_PUBLIC_ADSENSE_ID } ` }
93+ data-full-width-responsive = "true"
94+ > </ ins >
7895 </ Head >
7996 < body className = "!min-h-screen bg-zinc-50 dark:bg-black" >
8097 < Main />
You can’t perform that action at this time.
0 commit comments