mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-02 12:54:03 +00:00
Reusable AdUnit component (div[data-cp-ad] + ad.js via next/script) placed in-content on the blog index and post pages, scoped to /blog/* only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
573 B
TypeScript
20 lines
573 B
TypeScript
import type { ReactNode } from "react";
|
|
import Script from "next/script";
|
|
|
|
// CrawlProof ad unit, scoped to the pages that render it (currently /blog/*).
|
|
// The loader is deduped by src, so mounting <AdUnit /> on multiple routes only
|
|
// injects one https://crawlproof.com/ad.js.
|
|
export function AdUnit({
|
|
slot,
|
|
format = "banner_300x250",
|
|
}: {
|
|
slot: string;
|
|
format?: string;
|
|
}): ReactNode {
|
|
return (
|
|
<>
|
|
<div data-cp-ad data-slot={slot} data-format={format} />
|
|
<Script src="https://crawlproof.com/ad.js" strategy="afterInteractive" />
|
|
</>
|
|
);
|
|
}
|