45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
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") ?? "localhost:3000";
|
|
const protocol = requestHeaders.get("x-forwarded-proto") ?? (host.startsWith("localhost") ? "http" : "https");
|
|
const baseUrl = new URL(`${protocol}://${host}`);
|
|
|
|
return {
|
|
metadataBase: baseUrl,
|
|
title: "智能回收运营平台",
|
|
description: "面向内网部署的称重、设备、人员、人脸与告警管理后台",
|
|
icons: {
|
|
icon: "/favicon.svg",
|
|
shortcut: "/favicon.svg",
|
|
},
|
|
openGraph: {
|
|
title: "智能回收运营平台",
|
|
description: "称重、设备、人员与告警的一体化内网管理平台",
|
|
type: "website",
|
|
images: [{ url: new URL("/og.png", baseUrl).toString(), width: 1672, height: 941 }],
|
|
},
|
|
twitter: {
|
|
card: "summary_large_image",
|
|
title: "智能回收运营平台",
|
|
description: "称重、设备、人员与告警的一体化内网管理平台",
|
|
images: [new URL("/og.png", baseUrl).toString()],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html lang="zh-CN">
|
|
<body>{children}</body>
|
|
</html>
|
|
);
|
|
}
|