a16bf812e4
- CSS-переменные --bg, --surface, --ink, --mute, --accent для обеих тем - darkMode: 'class' в Tailwind config - ThemeToggle компонент с Sun/Moon, сохраняет выбор в localStorage - Inline-скрипт в layout.js защищает от FOUC (FlashOfUnstyledContent) - Авто-определение по prefers-color-scheme как fallback - not-found.js: красивая 404 страница вместо дефолтной Next - Обновлены все компоненты и страницы — Header, Footer, ArticleCard, page.js, blog, tag, about
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
import './globals.css';
|
|
|
|
export const metadata = {
|
|
title: {
|
|
default: 'ZeroPost — практические материалы про ИИ',
|
|
template: '%s — ZeroPost',
|
|
},
|
|
description: 'Блог про практическое применение искусственного интеллекта. Промпты, инструменты, кейсы — без воды.',
|
|
metadataBase: new URL('https://zeropost.ru'),
|
|
openGraph: {
|
|
type: 'website',
|
|
locale: 'ru_RU',
|
|
siteName: 'ZeroPost',
|
|
},
|
|
};
|
|
|
|
// Защита от FOUC: ставим тему до первого рендера
|
|
const themeInitScript = `
|
|
(function() {
|
|
try {
|
|
var saved = localStorage.getItem('theme');
|
|
var theme = saved || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
if (theme === 'dark') document.documentElement.classList.add('dark');
|
|
} catch(e) {}
|
|
})();
|
|
`;
|
|
|
|
export default function RootLayout({ children }) {
|
|
return (
|
|
<html lang="ru" suppressHydrationWarning>
|
|
<head>
|
|
<script dangerouslySetInnerHTML={{ __html: themeInitScript }} />
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Source+Serif+Pro:ital,wght@0,400;0,600;0,700;1,400&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
</head>
|
|
<body>{children}</body>
|
|
</html>
|
|
);
|
|
}
|