Skip to content

Commit 73fe2ab

Browse files
committed
Slots to disable ads from homepage
1 parent 06a0fc2 commit 73fe2ab

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/layouts/AccountLayout.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const props = Astro.props;
77
---
88

99
<BaseLayout {...props} noIndex={true}>
10+
<div slot='ad-slot-script'></div>
11+
<div slot='ad-slot'></div>
12+
1013
<slot />
1114
<div slot='login-popup'></div>
1215
<div slot='page-footer'></div>

src/layouts/BaseLayout.astro

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ const gaPageIdentifier = Astro.url.pathname
183183
}
184184

185185
<Analytics />
186-
<GoogleAd />
186+
187+
<slot name='ad-slot-script'>
188+
<GoogleAd />
189+
</slot>
187190

188191
{
189192
!import.meta.env.DEV && (
@@ -235,7 +238,10 @@ const gaPageIdentifier = Astro.url.pathname
235238
<PageProgress initialMessage={initialLoadingMessage} client:idle />
236239
<GlobalUpgradeModal client:only='react' />
237240

238-
<GoogleAdSlot />
241+
<slot name='ad-slot'>
242+
<GoogleAdSlot />
243+
</slot>
244+
239245
<slot name='after-footer' />
240246

241247
<PageVisit

src/layouts/SkeletonLayout.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const props = Astro.props;
77
---
88

99
<BaseLayout {...props}>
10+
<div slot='ad-slot-script'></div>
11+
<div slot='ad-slot'></div>
12+
1013
<div slot='course-announcement'></div>
1114
<div slot='page-header'></div>
1215
<slot />

src/pages/index.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ const videos = await getAllVideos();
4848
description={'Community driven roadmaps, articles and guides for developers to grow in their career.'}
4949
permalink={'/'}
5050
>
51+
<div slot='ad-slot-script'></div>
52+
<div slot='ad-slot'></div>
53+
5154
<div class='bg-linear-to-b from-slate-900 to-black'>
5255
<HeroSection />
5356

0 commit comments

Comments
 (0)