src/lib/seo.ts is the single source for page alternates (self canonical + hreflang hu/en/x-default), sitemap entries (every page in both languages, with alternates) and robots rules. Per the user's decisions every page is announced in both languages regardless of the English approval status, and staging is never indexed: robots.txt disallows all, the sitemap is empty and every page carries a noindex meta. Home and catch-all page metadata now carry alternates and a locale- correct og:url. Staging smoke SMOKE-09 checks hreflang, canonical, noindex and robots.txt. Documented in architecture.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.5 KiB
TypeScript
Executable File
75 lines
2.5 KiB
TypeScript
Executable File
import type { Metadata, Viewport } from "next";
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
import "./globals.css";
|
|
|
|
import { ThemeProvider } from "../../components/ThemeProvider";
|
|
import { siteConfig, getSiteDescription } from "../../config/site";
|
|
import { isIndexingDisabled } from "../../lib/seo";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-geist-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
variable: "--font-geist-mono",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
// WHY hu itt: ez a legkülső, nyelv-független layout (html/body/theme-script
|
|
// csak egyszer, MITHOME-91/114) — a metadataBase és az alap description a
|
|
// magyar (alapértelmezett) nyelvet tükrözi, de minden [locale]/[slug]
|
|
// oldal a saját generateMetadata()-jával felülírja title/description-t
|
|
// nyelvhelyesen. Ez csak a legelső, JS nélküli betöltéskori fallback.
|
|
export const metadata: Metadata = {
|
|
// WHY metadataBase: without it Next resolves relative OG/twitter image URLs
|
|
// against localhost, producing broken social previews in production.
|
|
metadataBase: new URL(siteConfig.general.url),
|
|
title: siteConfig.general.name,
|
|
description: getSiteDescription("hu"),
|
|
authors: [{ name: siteConfig.general.name }],
|
|
// MITHOME-116 (user decision): staging must never be indexed — noindex on
|
|
// every page, on top of the disallow-all robots.txt.
|
|
...(isIndexingDisabled() ? { robots: { index: false, follow: false } } : {}),
|
|
};
|
|
|
|
// Keep Safari's browser chrome neutral; only the in-page staging strip is amber.
|
|
export const viewport: Viewport = {
|
|
themeColor: '#ffffff',
|
|
};
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html lang="hu" suppressHydrationWarning>
|
|
<head>
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
(function() {
|
|
const savedTheme = localStorage.getItem('theme');
|
|
if (savedTheme === 'dark') {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
} else if (savedTheme === 'light') {
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
}
|
|
})();
|
|
`,
|
|
}}
|
|
/>
|
|
</head>
|
|
<body
|
|
className={`${geistSans.variable} ${geistMono.variable} antialiased min-h-screen flex flex-col`}
|
|
style={{ background: 'var(--color-background)', color: 'var(--color-foreground)' }}
|
|
>
|
|
<ThemeProvider>
|
|
{children}
|
|
</ThemeProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|