Skip to content

Commit bc5120a

Browse files
committed
chore: add validation to not add anchor ad into desktop
1 parent f671113 commit bc5120a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/src/theme/Footer/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export default function FooterWrapper(props) {
1919
}
2020
document.body.appendChild(scriptElement)
2121

22-
const adsElement = document.createElement('ins')
23-
adsElement.classList.add('adsbygoogle')
24-
adsElement.classList.add('adsanchor')
25-
adsElement.setAttribute('ad-client', 'ca-pub-7420210265158247')
26-
adsElement.setAttribute('ad-slot', '8159529807')
27-
adsElement.setAttribute('full-width-responsive', 'true')
28-
document.body.appendChild(adsElement)
22+
if (window.document.body.clientWidth <= 768) {
23+
const adsElement = document.createElement('ins')
24+
adsElement.classList.add('adsbygoogle')
25+
adsElement.classList.add('adsanchor')
26+
adsElement.setAttribute('ad-client', 'ca-pub-7420210265158247')
27+
adsElement.setAttribute('ad-slot', '8159529807')
28+
adsElement.setAttribute('full-width-responsive', 'true')
29+
document.body.appendChild(adsElement)
30+
}
2931
}
3032
}, [])
3133

0 commit comments

Comments
 (0)