From 8a91743d29c1ac5174337e64938f479a1af06d9a Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Sat, 25 Oct 2025 09:19:15 +0000 Subject: [PATCH 1/3] feat: add Google AdSense to post detail pages - Created AdSense component with responsive ad unit - Integrated AdSense script in post page head - Positioned ad at the end of article content - Added TODO comments for AdSense client ID and slot ID configuration Co-authored-by: Le He --- src/components/AdSense.astro | 28 ++++++++++++++++++++++++++++ src/pages/posts/[...slug].astro | 10 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/components/AdSense.astro diff --git a/src/components/AdSense.astro b/src/components/AdSense.astro new file mode 100644 index 0000000..7b0a614 --- /dev/null +++ b/src/components/AdSense.astro @@ -0,0 +1,28 @@ +--- +// Google AdSense component for displaying ads +// TODO: Replace 'ca-pub-XXXXXXXXXXXXXXXX' with your actual Google AdSense client ID +// TODO: Replace 'XXXXXXXXXX' with your actual ad slot ID +--- + +
+ +
+ + + + diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 9e2a443..2adc1bc 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -18,6 +18,7 @@ import A from "../../components/markdown/A.astro"; import P from "../../components/markdown/P.astro"; import type { InferGetStaticPropsType } from "astro"; import Player from "../../components/Player.astro"; +import AdSense from "../../components/AdSense.astro"; export async function getStaticPaths() { const posts = await getCollection("posts"); @@ -73,6 +74,14 @@ const imgUrl = `${Astro.site?.origin}${post.slug}-og.png`; })} /> + +
@@ -161,6 +170,7 @@ const imgUrl = `${Astro.site?.origin}${post.slug}-og.png`; }} />
+
From 0da7f542da648d5246ca95a33e5a1e32237e9e34 Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Sat, 25 Oct 2025 17:35:33 +0800 Subject: [PATCH 2/3] refactor(ads): consolidate AdSense script loading in main layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move AdSense initialization script from post detail page to the main Layout component for centralized management. Update AdSense client ID from placeholder to production value. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/components/AdSense.astro | 4 ++-- src/layouts/Layout.astro | 6 ++++++ src/pages/posts/[...slug].astro | 10 +--------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/AdSense.astro b/src/components/AdSense.astro index 7b0a614..d019b05 100644 --- a/src/components/AdSense.astro +++ b/src/components/AdSense.astro @@ -8,7 +8,7 @@ + \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 5537662..79275cc 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -27,6 +27,12 @@ const { title } = Astro.props; href={`${Astro.site}rss.xml`} /> +
@@ -185,4 +177,4 @@ const imgUrl = `${Astro.site?.origin}${post.slug}-og.png`; -webkit-background-clip: text; -webkit-text-fill-color: transparent; } - + \ No newline at end of file From f19378420980082d28c457e36642fe34224adbaf Mon Sep 17 00:00:00 2001 From: AnnatarHe Date: Sat, 25 Oct 2025 17:39:09 +0800 Subject: [PATCH 3/3] refactor(ads): remove unnecessary frontmatter comments from AdSense component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove TODO comments and frontmatter section that are no longer needed after AdSense integration is complete. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/components/AdSense.astro | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/AdSense.astro b/src/components/AdSense.astro index d019b05..24193b6 100644 --- a/src/components/AdSense.astro +++ b/src/components/AdSense.astro @@ -1,9 +1,3 @@ ---- -// Google AdSense component for displaying ads -// TODO: Replace 'ca-pub-XXXXXXXXXXXXXXXX' with your actual Google AdSense client ID -// TODO: Replace 'XXXXXXXXXX' with your actual ad slot ID ---- -