Jotley / website / src / app / layout.tsx
| 1 | import './globals.css'; |
| 2 | import type { Metadata } from 'next'; |
| 3 | import localFont from 'next/font/local'; |
| 4 | import { ThemeProvider } from '@/contexts/ThemeContext'; |
| 5 | import ConditionalLayout from './components/ConditionalLayout'; |
| 6 | import { ThemeScript } from './theme-script'; |
| 7 | import Script from 'next/script'; |
| 8 | import { pageMetadata, SITE_URL } from '@/lib/site-metadata'; |
| 9 | |
| 10 | const inter = localFont({ |
| 11 | src: '../../node_modules/@fontsource-variable/inter/files/inter-latin-wght-normal.woff2', |
| 12 | weight: '100 900', |
| 13 | variable: '--font-inter', |
| 14 | }); |
| 15 | const comfortaa = localFont({ |
| 16 | src: '../../node_modules/@fontsource-variable/comfortaa/files/comfortaa-latin-wght-normal.woff2', |
| 17 | weight: '300 700', |
| 18 | variable: '--font-comfortaa', |
| 19 | }); |
| 20 | const jetbrainsMono = localFont({ |
| 21 | src: '../../node_modules/@fontsource-variable/jetbrains-mono/files/jetbrains-mono-latin-wght-normal.woff2', |
| 22 | weight: '100 800', |
| 23 | variable: '--font-jetbrains', |
| 24 | }); |
| 25 | |
| 26 | export const metadata: Metadata = { |
| 27 | metadataBase: new URL(SITE_URL), |
| 28 | applicationName: 'Jotley', |
| 29 | ...pageMetadata('home'), |
| 30 | // Each public page defines its own canonical; errors must not inherit '/'. |
| 31 | alternates: undefined, |
| 32 | robots: (process.env.VERCEL_ENV ?? process.env.CLOUDFLARE_DEPLOYMENT_ENV) === 'preview' ? { index: false, follow: false } : undefined, |
| 33 | }; |
| 34 | |
| 35 | export default function RootLayout({ |
| 36 | children, |
| 37 | }: { |
| 38 | children: React.ReactNode; |
| 39 | }) { |
| 40 | // Website maintenance mode is handled by middleware.ts. |
| 41 | |
| 42 | return ( |
| 43 | <html lang="en" suppressHydrationWarning> |
| 44 | <head> |
| 45 | <ThemeScript /> |
| 46 | <link rel="stylesheet" href="/assets/visitor-odometer.v1.css" /> |
| 47 | <script defer src="/assets/visitor-odometer.v1.js"></script> |
| 48 | {/* No orphans: no single word alone on a last line (shared fix, hosting-research assets/no-orphans). */} |
| 49 | <link rel="stylesheet" href="/no-orphans.css" /> |
| 50 | <script src="/no-orphans.js" defer /> |
| 51 | </head> |
| 52 | <body className={`${inter.className} ${inter.variable} ${comfortaa.variable} ${jetbrainsMono.variable}`}> |
| 53 | <ThemeProvider> |
| 54 | <ConditionalLayout>{children}</ConditionalLayout> |
| 55 | </ThemeProvider> |
| 56 | {/* Share buttons (components/ShareButton.tsx) */} |
| 57 | <Script src="/share.js" strategy="afterInteractive" /> |
| 58 | </body> |
| 59 | </html> |
| 60 | ); |
| 61 | } |