diff --git a/src/app/(main)/(marketing)/layout.tsx b/src/app/(main)/(marketing)/layout.tsx index afe84e7..3a88745 100644 --- a/src/app/(main)/(marketing)/layout.tsx +++ b/src/app/(main)/(marketing)/layout.tsx @@ -1,4 +1,5 @@ import type { Metadata } from 'next'; +import AdBanner from '@/components/ads/AdBanner'; import '@/styles/globals.css'; import { Providers } from '@/components/Providers'; import MarketingLayout from './MarketingLayout'; @@ -61,6 +62,15 @@ export default function MarketingGroupLayout({ {children} + {/* Global Marketing Ad - Exclusions handled in AdBanner */} +
+ +
); } diff --git a/src/app/(main)/(marketing)/tools/layout.tsx b/src/app/(main)/(marketing)/tools/layout.tsx index 8141639..4abcf02 100644 --- a/src/app/(main)/(marketing)/tools/layout.tsx +++ b/src/app/(main)/(marketing)/tools/layout.tsx @@ -19,7 +19,7 @@ export default function ToolsLayout({ {/* AdBanner handles its own visibility - only shows when an ad is filled */}
{children} + + {/* Global Marketing Ad - Exclusions handled in AdBanner */} +
+ +
diff --git a/src/components/ads/AdBanner.tsx b/src/components/ads/AdBanner.tsx index 9443b25..ee7e79d 100644 --- a/src/components/ads/AdBanner.tsx +++ b/src/components/ads/AdBanner.tsx @@ -3,6 +3,8 @@ import { useEffect, useState, useRef } from 'react'; import { useSession } from 'next-auth/react'; +import { usePathname } from 'next/navigation'; + interface AdBannerProps { dataAdSlot: string; dataAdFormat?: string; @@ -17,9 +19,30 @@ export default function AdBanner({ className = '', }: AdBannerProps) { const { data: session, status } = useSession(); + const pathname = usePathname(); const adRef = useRef(null); const [adFilled, setAdFilled] = useState(false); + // Paths where ads should NOT be shown + const excludedPaths = [ + '/', // English Home + '/de', // German Home + '/qr-code-erstellen', // German Landing + '/contact', // Contact + '/about', // About + '/legal', // Legal pages + '/privacy', + '/terms', + '/cookie-policy', + '/impressum', + ]; + + // Check if current path matches strictly or starts with excluded path (for nested legal/blog pages if needed, though mostly exact matches here) + const shouldExclude = excludedPaths.some(path => { + if (path === '/') return pathname === '/'; + return pathname === path || pathname?.startsWith(`${path}/`); + }); + // Check if user has a paid plan const isPaidUser = session?.user && ( session.user.plan === 'PRO' || @@ -27,6 +50,8 @@ export default function AdBanner({ session.user.plan === 'LIFETIME' ); + if (shouldExclude) return null; + useEffect(() => { // Don't load if loading session or if user is paid if (status === 'loading' || isPaidUser) return;