From 5c251c3fe6b86388f3d3eb762389647da59e26c1 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 1 May 2026 18:30:37 +0800 Subject: [PATCH] add Google AdSense auto-ads loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shares the same publisher account as qipaobuzz (ca-pub-9763775565109295). site.ads = { enabled: true, publisherId: '9763775565109295' }; Layout conditionally injects the adsbygoogle.js loader in when ads are enabled, letting Google's auto-ads system place units automatically (no manual slots — start with auto-ads, can add explicit slots later if specific placements are needed). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/layouts/Layout.astro | 9 +++++++++ src/lib/site.js | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 03c251e..21d0d71 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -12,6 +12,7 @@ const { const pageTitle = title || site.name; const ogUrl = canonical || Astro.url.toString(); const year = new Date().getFullYear(); +const ads = site.ads; --- @@ -44,6 +45,14 @@ const year = new Date().getFullYear(); + {ads?.enabled && ( +