2026-07-30 12:06:41 +08:00
|
|
|
|
import type { Metadata } from "next";
|
|
|
|
|
|
import { headers } from "next/headers";
|
|
|
|
|
|
import "./globals.css";
|
|
|
|
|
|
|
|
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
|
|
|
|
const requestHeaders = await headers();
|
|
|
|
|
|
const host = requestHeaders.get("x-forwarded-host") || requestHeaders.get("host");
|
|
|
|
|
|
const protocol =
|
|
|
|
|
|
requestHeaders.get("x-forwarded-proto") ||
|
|
|
|
|
|
(host?.startsWith("localhost") ? "http" : "https");
|
|
|
|
|
|
const metadataBase = host
|
|
|
|
|
|
? new URL(`${protocol}://${host}`)
|
|
|
|
|
|
: new URL("https://koc-loop.example.com");
|
|
|
|
|
|
const description =
|
|
|
|
|
|
"面向KOC运营团队的轻量资源管理、内容分发与数据回收平台。";
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
metadataBase,
|
|
|
|
|
|
title: "KOC LOOP|内容分发闭环",
|
|
|
|
|
|
description,
|
|
|
|
|
|
icons: {
|
|
|
|
|
|
icon: "/favicon.svg",
|
|
|
|
|
|
shortcut: "/favicon.svg",
|
|
|
|
|
|
},
|
|
|
|
|
|
openGraph: {
|
|
|
|
|
|
title: "KOC LOOP|内容分发闭环",
|
|
|
|
|
|
description,
|
|
|
|
|
|
type: "website",
|
|
|
|
|
|
images: [
|
|
|
|
|
|
{
|
|
|
|
|
|
url: new URL("/og.png", metadataBase).toString(),
|
|
|
|
|
|
width: 1200,
|
|
|
|
|
|
height: 630,
|
|
|
|
|
|
alt: "KOC LOOP 资源管理、内容分发与数据回收",
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
twitter: {
|
|
|
|
|
|
card: "summary_large_image",
|
|
|
|
|
|
title: "KOC LOOP|内容分发闭环",
|
|
|
|
|
|
description,
|
|
|
|
|
|
images: [new URL("/og.png", metadataBase).toString()],
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default function RootLayout({
|
|
|
|
|
|
children,
|
|
|
|
|
|
}: Readonly<{ children: React.ReactNode }>) {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<html lang="zh-CN">
|
2026-08-11 23:07:26 +08:00
|
|
|
|
<body>{children}</body>
|
2026-07-30 12:06:41 +08:00
|
|
|
|
</html>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|