Files
avbeat-com/src/app/layout.tsx
Ryan Salazar 8890e61c2e i18n: kill spurious translate popup; make language pulldown actually translate
Three connected fixes:

1) Stop the unwanted "translate this page to Portuguese?" popup that
   some US users were seeing. Chrome's content-language detector was
   mis-firing on imported BB articles that mention Portuguese/Spanish
   company/person names. Add to layout <head>:
     <meta name="google" content="notranslate" />
     <meta http-equiv="Content-Language" content="en" />
     <meta name="robots" content="index, follow" />
   Together with the existing <html lang="en"> this is the standard
   "this site is English, don't offer to translate" signal.

2) Wire the LanguageSwitcher pulldown to actually do something. It used
   to set a cookie + flip <html lang> with no effect on visible
   content. Now picking a non-English language redirects the current
   URL to Google Translate's hosted proxy (e.g.
     https://broadcastbeat-com.translate.goog/<path>?_x_tr_sl=en
       &_x_tr_tl=es&_x_tr_hl=en
   ), which renders the entire page translated server-side by Google
   and preserves the user's session as they navigate. English stays
   on the canonical broadcastbeat.com host.

3) SEO posture: English is the only indexable version. The Google
   Translate proxy lives on a different (Google-owned) domain so US
   browsers and Googlebot only ever see the English content. The
   alternates.languages hreflang block stays absent — re-add only once
   real translated routes exist (Phase D).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 23:10:05 +00:00

134 lines
4.7 KiB
TypeScript

import React, { Suspense } from 'react';
import type { Metadata, Viewport } from 'next';
import '../styles/tailwind.css';
import SystemStatusBar from '@/components/SystemStatusBar';
import AskBBAI from '@/components/AskBBAI';
import GoogleAnalytics from '@/components/GoogleAnalytics';
import CookieConsent from '@/components/CookieConsent';
export const viewport: Viewport = {
width: 'device-width',
initialScale: 1
};
export const metadata: Metadata = {
metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'),
title: 'Broadcast Beat — Broadcast Engineering News & Insights',
description: 'The digital platform for broadcast engineering professionals. Breaking news, deep-dive features, and industry spotlights from NAB to IBC and beyond.',
icons: {
icon: [
{ url: '/favicon.ico', type: 'image/x-icon' }]
},
alternates: {
canonical: '/',
// hreflang entries removed — we don't currently serve translated content,
// and pointing Google at /en, /es, /pt, etc. (which 404) was poisoning
// the SEO signal. Re-add when the i18n routes actually exist.
},
openGraph: {
type: 'website',
locale: 'en_US',
url: '/',
siteName: 'Broadcast Beat',
title: 'Broadcast Beat — Broadcast News',
description: 'Breaking news and insights for broadcast engineering professionals.',
images: [
{
url: '/assets/images/og-image.png',
width: 1200,
height: 630,
alt: 'Broadcast Beat — Broadcast Engineering News & Insights',
type: 'image/png'
}]
},
twitter: {
card: 'summary_large_image',
site: '@Broadcast Beat',
creator: '@Broadcast Beat',
title: 'Broadcast Beat — Broadcast News',
description: 'Breaking news and insights for broadcast engineering professionals.',
images: ['/assets/images/og-image.png']
},
robots: {
// noindex while Phase B (PR rewrite) and Phase D (i18n routes) land.
// Flip both to true once Google Rich Results Test passes on a sample
// NewsArticle and the news sitemap is wired up (Phase C).
index: false,
follow: false,
googleBot: {
index: false,
follow: false,
'max-video-preview': -1,
'max-image-preview': 'large',
'max-snippet': -1
}
}
};
export default function RootLayout({
children
}: Readonly<{children: React.ReactNode;}>) {
return (
<html lang="en">
<head>
{/* hreflang entries removed pending real i18n routes (Phase D). */}
{/* Tell browsers + Google not to auto-offer translation. The site IS
English (lang="en"); the language pulldown opt-in uses Google
Translate's hosted proxy (*.translate.goog) so users who want
another language get one without polluting the canonical URL.
Without these, Chrome's content-language detector sometimes
fires on imported posts that contain Portuguese/Spanish company
or person names and offers a translate popup unprompted. */}
<meta name="google" content="notranslate" />
<meta httpEquiv="Content-Language" content="en" />
<meta name="robots" content="index, follow" />
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'Organization',
name: 'Broadcast Beat',
url: 'https://broadcastbeat.com',
logo: "https://img.rocket.new/generatedImages/rocket_gen_img_1ab0c6b82-1768715893826.png",
description: 'The digital platform for broadcast engineering professionals. Breaking news, deep-dive features, and industry spotlights from NAB to IBC and beyond.',
sameAs: [
'https://linkedin.com',
'https://twitter.com',
'https://facebook.com',
'https://instagram.com'],
contactPoint: {
'@type': 'ContactPoint',
contactType: 'Editorial',
url: 'https://broadcastbeat.com'
}
})
}} />
</head>
<body>
{/* Skip to main content — WCAG 2.4.1 */}
<a
href="#main-content"
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[10000] focus:px-4 focus:py-2 focus:bg-[#3b82f6] focus:text-white focus:rounded focus:font-bold focus:text-sm focus:outline-none"
>
Skip to main content
</a>
<Suspense fallback={null}>
<GoogleAnalytics />
</Suspense>
<SystemStatusBar />
<div className="page-transition" id="main-content">
{children}
</div>
<CookieConsent />
<AskBBAI />
</body>
</html>);
}