ads + i18n: forum/newsletter banners; smarter language autodetect

Forum:
  - /forum landing: switch to 2-col layout, add SidebarAdStack
    (300x600 + every 300x250) on the right.
  - /forum/thread/[id]: insert one 300x250 "Sponsored" tile after
    every 4 replies (idx 3, 7, 11 …). Trailing-ad guard so the last
    reply isn't followed by an ad with no replies after it. Cycles
    through the full ADS_300X250 pool by index so every banner gets
    impressions across long threads.

Newsletter:
  - /newsletter/archive: drop SidebarAdStack into the existing
    right rail above the signup CTA + topic browser.

LanguageSwitcher autodetect (US default for US users was failing):
  1. Timezone override: if the user is in America/*, Pacific/Honolulu,
     Pacific/Auckland|Wellington, Australia/*, Europe/London|Dublin,
     or Atlantic/Reykjavik — always return 'en'. Fixes US-based
     users whose OS locale happened to be set to a non-English value.
  2. Otherwise walk navigator.languages (the full preference list,
     not just navigator.language[0]) and pick the first base code we
     support (en/es/pt/fr/de/zh/ja/ar/hi).
  3. Fallback to 'en'.

  All non-en selections still route through Google Translate's hosted
  proxy on the .translate.goog subdomain — search engines and US
  visitors continue to only ever see English on broadcastbeat.com.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ryan Salazar
2026-05-20 05:52:00 +00:00
parent b4eb56c81d
commit a1829e7628
4 changed files with 114 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ import Link from 'next/link';
import Header from '@/components/Header';
import Footer from '@/components/Footer';
import AdImage from '@/components/AdImage';
import SidebarAdStack from '@/components/SidebarAdStack';
import { ADS_728X90, shuffle } from '@/lib/ads';
import { createClient } from '@/lib/supabase/client';
@@ -274,6 +275,8 @@ export default function ForumIndexPage() {
</div>
<div className="max-w-container mx-auto px-4 py-6">
<div className="lg:grid lg:grid-cols-[1fr,300px] lg:gap-8">
<div>
{/* Feed Mode Tabs */}
<div className="flex items-center gap-1 bg-[#1a1a1a] border border-[#2a2a2a] rounded-lg p-1 mb-6 w-fit">
@@ -576,6 +579,15 @@ export default function ForumIndexPage() {
<AdImage ad={shuffle(ADS_728X90)[0]} page="forum" />
</div>
)}
</div>
{/* Sidebar: 300x600 + every rotating 300x250 */}
<aside className="mt-10 lg:mt-0" aria-label="Advertisements">
<div className="lg:sticky lg:top-24">
<SidebarAdStack />
</div>
</aside>
</div>
</div>
</main>
<Footer />