Initial commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-11-05 20:30:26 +07:00
co-authored by Claude Opus 5.5
commit 6bd5cc665a
335 changed files with 44261 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
import type { Metadata } from "next";
import Script from "next/script";
import { AppShell } from "@/components/layout/AppShell";
import { getRequestOrigin, OG_DEFAULT_IMAGE, SITE_NAME } from "@/lib/seo";
import "./globals.css";
export const instant = false;
const GTAG_ID = process.env.NEXT_PUBLIC_GTAG_ID?.trim() || "";
/** metadataBase 随请求 Host 变化,保证 og:image 为绝对地址 */
export async function generateMetadata(): Promise<Metadata> {
const origin = await getRequestOrigin();
return {
metadataBase: new URL(origin),
title: {
default: "黄豆短剧",
template: "%s",
},
description: "黄豆魔改短剧,发现值得一看的短剧。",
applicationName: SITE_NAME,
openGraph: {
type: "website",
locale: "zh_CN",
siteName: SITE_NAME,
images: [{ url: OG_DEFAULT_IMAGE, alt: SITE_NAME, width: 700, height: 400 }],
},
twitter: {
card: "summary_large_image",
images: [OG_DEFAULT_IMAGE],
},
icons: { icon: "/favicon.png" },
verification: {
yandex: "2cd6a987a1bb3b58",
other: {
"msvalidate.01": "431F89B229D3A00661DAF708E5C24BC0",
},
},
};
}
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="zh-CN" className="dark" data-theme="dark" data-scroll-behavior="smooth">
<body>
<AppShell>{children}</AppShell>
{GTAG_ID ? (
<>
<Script
id="ga4-tag"
src={`https://www.googletagmanager.com/gtag/js?id=${GTAG_ID}`}
strategy="afterInteractive"
/>
<Script id="ga4-init" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GTAG_ID}');
`}
</Script>
</>
) : null}
</body>
</html>
);
}