diff --git a/app/[[...slug]]/page.tsx b/app/[[...slug]]/page.tsx index 38a9bce..a19b466 100644 --- a/app/[[...slug]]/page.tsx +++ b/app/[[...slug]]/page.tsx @@ -6,7 +6,6 @@ import { } from "fumadocs-ui/page"; import type { Metadata } from "next"; import { notFound } from "next/navigation"; -import Adsense from "@/app/components/Adsense"; import { source } from "@/lib/source"; import { useMDXComponents } from "@/mdx-components"; @@ -26,7 +25,6 @@ export default async function Page(props: { {page.data.description} - ); diff --git a/app/components/Adsense.tsx b/app/components/Adsense.tsx deleted file mode 100644 index 90a55d0..0000000 --- a/app/components/Adsense.tsx +++ /dev/null @@ -1,43 +0,0 @@ -"use client"; - -import { usePathname } from "next/navigation"; -import { useEffect } from "react"; - -interface AdsenseProps { - adSlot?: string; -} - -export default function Adsense({ adSlot }: AdsenseProps) { - const pathname = usePathname(); - const adClient = - process.env.NEXT_PUBLIC_ADSENSE_CLIENT || "ca-pub-2837724975096238"; - - useEffect(() => { - if (!adClient) return; - - try { - // @ts-expect-error - const ads = window.adsbygoogle || []; - // @ts-expect-error - window.adsbygoogle = ads; - ads.push({}); - } catch (err) { - console.error("Adsense push error:", err); - } - }, [pathname, adClient]); - - if (!adClient) return null; - - return ( -
- -
- ); -} diff --git a/mdx-components.tsx b/mdx-components.tsx index e75fb25..402a723 100644 --- a/mdx-components.tsx +++ b/mdx-components.tsx @@ -3,7 +3,6 @@ import { Step, Steps } from "fumadocs-ui/components/steps"; import defaultComponents from "fumadocs-ui/mdx"; import type { MDXComponents } from "mdx/types"; import NextImage, { type ImageProps } from "next/image"; -import Adsense from "@/app/components/Adsense"; export function useMDXComponents(components: MDXComponents): MDXComponents { return { @@ -11,7 +10,6 @@ export function useMDXComponents(components: MDXComponents): MDXComponents { Callout, Steps, Step, - Adsense, Image: (props: ImageProps) => (