Files
kovakyazilim/app/layout.tsx
T
Ege Can Komur 9d74cceb69 fix: ConsentInit'i <head>'den <body>'e taşı (Next.js 16 uyumu)
Hata:
> Encountered a script tag while rendering React component.
> Scripts inside React components are never executed when rendering on the client.

Sebep:
Next.js 16 React 19'da next/script'i <head> içine koyamıyoruz. Script'ler
body içinde render edilmeli — Next.js zaten doğru yere yerleştiriyor.

Çözüm:
ConsentInit'i app/layout.tsx içinde <head>'den çıkardık, body'nin
ilk elementi olarak koyduk. beforeInteractive strategy hala çalışıyor
(Next.js doğru sırayı yönetiyor).
2026-05-20 18:49:15 +03:00

61 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Metadata } from "next";
import { Poppins, Geist_Mono } from "next/font/google";
import "./globals.css";
import { siteConfig } from "@/lib/site-config";
import { ConsentInit } from "@/components/consent-init";
import { CookieBanner } from "@/components/cookie-banner";
import { getSeoSettings } from "@/lib/data";
const poppins = Poppins({
variable: "--font-poppins",
subsets: ["latin", "latin-ext"],
weight: ["300", "400", "500", "600", "700", "800"],
display: "swap",
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: {
default: `${siteConfig.name} — Yazılım, Web ve CRM Çözümleri`,
template: `%s | ${siteConfig.name}`,
},
description: siteConfig.tagline,
metadataBase: new URL(siteConfig.url),
openGraph: {
title: siteConfig.name,
description: siteConfig.tagline,
locale: "tr_TR",
type: "website",
},
icons: { icon: "/logo.png" },
};
export default async function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
let gtmId: string | null = null;
try {
const seo = await getSeoSettings();
gtmId = seo?.gtm_id ?? null;
} catch {
gtmId = null;
}
return (
<html
lang="tr"
className={`${poppins.variable} ${geistMono.variable} h-full antialiased`}
>
<body className="min-h-full flex flex-col bg-white text-[var(--foreground)]">
<ConsentInit gtmId={gtmId} />
{children}
<CookieBanner />
</body>
</html>
);
}