feat(web): ad.network unit + claim meta on the home page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-19 12:40:39 +00:00
parent 92d0666e98
commit 445554459f
5 changed files with 48 additions and 1 deletions

View file

@ -115,5 +115,22 @@ export function HomeInteractivity(): null {
};
}, []);
// The home page ad.network unit lives in the server-rendered markup, and
// crawlproof's ad.js scans once at DOMContentLoaded. A client-side visit to
// "/" (from /blog, say) re-renders the markup after that scan, so ask the
// loader to scan again, retrying briefly while the script is still loading.
useEffect(() => {
if (!document.querySelector("[data-ad-network]")) return;
let tries = 0;
const timer = window.setInterval(() => {
const ads = (window as { crawlproofAds?: { scan?: () => void } }).crawlproofAds;
if (ads?.scan || ++tries >= 20) {
window.clearInterval(timer);
ads?.scan?.();
}
}, 250);
return () => window.clearInterval(timer);
}, []);
return null;
}