Skip to content

Commit 5946231

Browse files
ralyodioclaude
andauthored
Move CrawlProof ad out of layout body into page content (#492)
The "Add CrawlProof ad unit" bot (#491) injected a bare <div data-cp-ad> at the tail of <body> in app/layout.tsx, so the 300x250 ad rendered below the footer on every page. Replace it with an <AdUnit /> component placed inside real page content on the home, gigs, for-hire, and blog list + detail views. The ad.js loader stays global in the layout. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 77807e1 commit 5946231

8 files changed

Lines changed: 41 additions & 1 deletion

File tree

src/app/blog/[slug]/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { notFound } from "next/navigation";
22
import Link from "next/link";
33
import { Header } from "@/components/layout/Header";
4+
import { AdUnit } from "@/components/AdUnit";
45
import { createServiceClient } from "@/lib/supabase/service";
56

67
export const dynamic = "force-dynamic";
@@ -80,6 +81,8 @@ export default async function BlogPost({ params }: { params: Promise<{ slug: str
8081
) : (
8182
<p className="mt-6 text-muted-foreground">This post has no body content.</p>
8283
)}
84+
85+
<AdUnit />
8386
</main>
8487
</>
8588
);

src/app/blog/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Image from "next/image";
22
import Link from "next/link";
33
import { Header } from "@/components/layout/Header";
4+
import { AdUnit } from "@/components/AdUnit";
45
import { createServiceClient } from "@/lib/supabase/service";
56

67
export const metadata = {
@@ -142,6 +143,8 @@ export default async function BlogIndex() {
142143
))}
143144
</ul>
144145
)}
146+
147+
<AdUnit />
145148
</main>
146149
</>
147150
);

src/app/for-hire/[[...tags]]/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { GigFiltersWithTags } from "@/components/gigs/GigFiltersWithTags";
77
import { Button } from "@/components/ui/button";
88
import { Skeleton } from "@/components/ui/skeleton";
99
import { Header } from "@/components/layout/Header";
10+
import { AdUnit } from "@/components/AdUnit";
1011
import { parsePageParam } from "@/lib/pagination";
1112
import { fetchGigs } from "@/lib/gigs/fetch-gigs";
1213
import type { GigCardData } from "@/components/gigs/GigCard";
@@ -214,6 +215,8 @@ export default async function ForHirePage({ params, searchParams }: GigsPageProp
214215
<GigsList params={params} searchParams={searchParams} />
215216
</Suspense>
216217
</div>
218+
219+
<AdUnit />
217220
</div>
218221
</main>
219222
</div>

src/app/gigs/[[...tags]]/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { GigFiltersWithTags } from "@/components/gigs/GigFiltersWithTags";
77
import { Button } from "@/components/ui/button";
88
import { Skeleton } from "@/components/ui/skeleton";
99
import { Header } from "@/components/layout/Header";
10+
import { AdUnit } from "@/components/AdUnit";
1011
import { hasActiveGigFilters } from "@/lib/gigs/filter-state";
1112
import { parsePageParam } from "@/lib/pagination";
1213
import { fetchGigs } from "@/lib/gigs/fetch-gigs";
@@ -220,6 +221,8 @@ export default async function GigsPage({ params, searchParams }: GigsPageProps)
220221
<GigsList params={params} searchParams={searchParams} />
221222
</Suspense>
222223
</div>
224+
225+
<AdUnit />
223226
</div>
224227
</main>
225228
</div>

src/app/gigs/[id]/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { PriceBox, PriceBoxRow } from "@/components/ui/PriceBox";
3030
import { ZapButton } from "@/components/zaps/ZapButton";
3131
import { GigTestimonialSection } from "@/components/testimonials/GigTestimonialSection";
3232
import { HiredWorkerReview } from "@/components/gigs/HiredWorkerReview";
33+
import { AdUnit } from "@/components/AdUnit";
3334
import { createServiceClient } from "@/lib/supabase/service";
3435

3536
interface GigPageProps {
@@ -550,6 +551,8 @@ export default async function GigPage({ params }: GigPageProps) {
550551

551552
{/* Escrow Services */}
552553
<EscrowBadge variant="compact" />
554+
555+
<AdUnit className="my-0" />
553556
</div>
554557
</div>
555558
</main>

src/app/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ export default function RootLayout({
101101
/>
102102
<Script data-site="3b787b18-f8e1-473f-8285-b90d657f5642" src="https://crawlproof.com/stats.js" strategy="afterInteractive" />
103103
<script async src="https://feedback.profullstack.com/embed/profullstack-feedback.js" data-property="ugig.net"></script>
104-
<div data-cp-ad="" data-slot="9384bcb3-7375-4f33-b671-c73a63bd2b12" data-format="banner_300x250" />
105104
<Script src="https://crawlproof.com/ad.js" strategy="afterInteractive" />
106105
</body>
107106
</html>

src/app/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Link from "next/link";
22
import { Search, Users, Video, Zap, Check, ArrowRight, Sparkles, Bot, Terminal, Key, Download } from "lucide-react";
33
import { Header } from "@/components/layout/Header";
4+
import { AdUnit } from "@/components/AdUnit";
45
import { createClient } from "@/lib/supabase/server";
56

67
async function getAuthStatus() {
@@ -344,6 +345,10 @@ ugig config set api_key ugig_live_... # store your API key`}</code></pre>
344345
</div>
345346
</div>
346347
</section>
348+
349+
<div className="container mx-auto px-4">
350+
<AdUnit />
351+
</div>
347352
</main>
348353

349354
</div>

src/components/AdUnit.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* CrawlProof ad slot, rendered inside page content (never at the tail of
3+
* <body>, which puts it below the footer). The global ad.js loader in the
4+
* root layout fills every [data-cp-ad] slot in place with a 300x250 iframe.
5+
*/
6+
const CP_AD_SLOT = "9384bcb3-7375-4f33-b671-c73a63bd2b12";
7+
8+
export function AdUnit({ className = "" }: { className?: string }) {
9+
return (
10+
<div className={`my-8 flex flex-col items-center ${className}`}>
11+
<span className="mb-1 text-[10px] uppercase tracking-wide text-muted-foreground">
12+
Advertisement
13+
</span>
14+
<div
15+
data-cp-ad=""
16+
data-slot={CP_AD_SLOT}
17+
data-format="banner_300x250"
18+
/>
19+
</div>
20+
);
21+
}

0 commit comments

Comments
 (0)