37 lines
1.3 KiB
TypeScript
37 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 metadataBase = new URL(`${protocol}://${host}`);
|
||
|
||
return {
|
||
metadataBase,
|
||
title: "高徳乐 AI 舵机选型助手",
|
||
description: "3分钟获得高徳乐舵机候选型号、匹配理由与样品申请方案。",
|
||
openGraph: {
|
||
title: "高徳乐 AI 舵机选型助手",
|
||
description: "3分钟,找到适合你的舵机。AI初选,工程师复核。",
|
||
images: [{ url: new URL("/og.png", metadataBase).toString(), width: 1200, height: 630 }],
|
||
type: "website",
|
||
},
|
||
twitter: {
|
||
card: "summary_large_image",
|
||
title: "高徳乐 AI 舵机选型助手",
|
||
description: "3分钟,找到适合你的舵机。",
|
||
images: [new URL("/og.png", metadataBase).toString()],
|
||
},
|
||
};
|
||
}
|
||
|
||
export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||
return (
|
||
<html lang="zh-CN">
|
||
<body>{children}</body>
|
||
</html>
|
||
);
|
||
}
|