Skip to content

Commit a80d219

Browse files
committed
Update adsense
1 parent f4a6aa4 commit a80d219

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

quartz.layout.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ export const sharedPageComponents: SharedLayout = {
66
head: Component.Head(),
77
header: [],
88
afterBody: [
9-
Component.Adsense({
10-
client:"ca-pub-1829817529831781"
11-
}),
9+
Component.DesktopOnly(
10+
Component.Adsense({
11+
client:"ca-pub-1829817529831781"
12+
})
13+
),
1214
Component.Comments({
1315
provider: 'giscus',
1416
options: {

quartz/components/Adsense.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,22 @@ const defaultOptions: Options = {
1111
export default ((opts: Options) => {
1212
const Adsense: QuartzComponent = ({ cfg }: QuartzComponentProps) => {
1313
return (
14-
<script
15-
async
16-
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${opts.client}`}
17-
crossOrigin="anonymous"
18-
></script>
14+
<div>
15+
<script
16+
async
17+
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${opts.client}`}
18+
crossorigin="anonymous">
19+
</script>
20+
<ins class="adsbygoogle"
21+
style="display:block"
22+
data-ad-client={`${opts.client}`}
23+
data-ad-slot="7543380157"
24+
data-ad-format="auto"
25+
data-full-width-responsive="true"></ins>
26+
<script>
27+
(adsbygoogle = window.adsbygoogle || []).push({});
28+
</script>
29+
</div>
1930
)
2031
}
2132

0 commit comments

Comments
 (0)