43 lines
1.3 KiB
TypeScript
43 lines
1.3 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 base = new URL(`${protocol}://${host}`);
|
|
const title = "沃尔核材智能回收管理平台";
|
|
const description = "统一接入人脸识别回收箱、电子台秤、地磅与 RFID 系统的生产回收管理平台。";
|
|
|
|
return {
|
|
metadataBase: base,
|
|
title,
|
|
description,
|
|
icons: {
|
|
icon: "/favicon.svg",
|
|
shortcut: "/favicon.svg",
|
|
},
|
|
openGraph: {
|
|
title,
|
|
description,
|
|
type: "website",
|
|
images: [{ url: new URL("/og.png", base).toString(), width: 1731, height: 909, alt: title }],
|
|
},
|
|
twitter: {
|
|
card: "summary_large_image",
|
|
title,
|
|
description,
|
|
images: [new URL("/og.png", base).toString()],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
|
return (
|
|
<html lang="zh-CN">
|
|
<body>{children}</body>
|
|
</html>
|
|
);
|
|
}
|