Skip to content

Commit 5877c91

Browse files
committed
chore: add google adsense into docs again and comment GAM implementation
1 parent 01c4a6f commit 5877c91

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

docs/docusaurus.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ const config = {
3030
},
3131

3232
scripts: [
33-
{
34-
src: 'https://securepubads.g.doubleclick.net/tag/js/gpt.js',
35-
async: true,
36-
},
37-
{
38-
src: '/js/gpt.js',
39-
async: true,
40-
},
33+
// {
34+
// src: 'https://securepubads.g.doubleclick.net/tag/js/gpt.js',
35+
// async: true,
36+
// },
37+
// {
38+
// src: '/js/gpt.js',
39+
// async: true,
40+
// },
4141
],
4242

4343
presets: [

docs/src/theme/Footer/index.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
/* eslint-disable import/no-unresolved */
2-
import React from 'react'
2+
import React, { useEffect } from 'react'
33
import Footer from '@theme-original/Footer'
44
// import AdsContainerElement from '@site/src/components/AdsContainerElement'
55

66
export default function FooterWrapper(props) {
7+
useEffect(() => {
8+
if (typeof window !== 'undefined') {
9+
const scriptElement = document.createElement('script')
10+
scriptElement.src =
11+
'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7420210265158247'
12+
scriptElement.async = true
13+
scriptElement.onload = () => {
14+
if (typeof window !== 'undefined') {
15+
window.onload = () => {
16+
;(window.adsbygoogle = window.adsbygoogle || []).push({})
17+
}
18+
}
19+
}
20+
document.body.appendChild(scriptElement)
21+
}
22+
}, [])
23+
724
return (
825
<>
926
<Footer {...props} />

docs/src/theme/TOC/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
/* eslint-disable import/no-unresolved */
22
import React from 'react'
33
import TOC from '@theme-original/TOC'
4-
import AdsContainerElement from '@site/src/components/AdsContainerElement'
4+
// import AdsContainerElement from '@site/src/components/AdsContainerElement'
55

66
export default function TOCWrapper(props) {
77
return (
88
<>
99
<TOC {...props} />
10-
<AdsContainerElement id="right-sidebar-ads" />
10+
{/* <AdsContainerElement id="right-sidebar-ads" /> */}
11+
<ins
12+
className="adsbygoogle"
13+
style={{ display: 'block', position: 'fixed' }}
14+
data-ad-client="ca-pub-7420210265158247"
15+
data-ad-slot="8711379942"
16+
data-ad-format="auto"
17+
data-full-width-responsive="true"
18+
/>
1119
</>
1220
)
1321
}

0 commit comments

Comments
 (0)