111 lines
2.9 KiB
TypeScript
111 lines
2.9 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Playfair_Display, Noto_Serif_SC } from "next/font/google";
|
|
import "../globals.css";
|
|
import Navbar from "@/components/Navbar";
|
|
import Footer from "@/components/Footer";
|
|
import {NextIntlClientProvider} from 'next-intl';
|
|
import {getMessages, getTranslations} from 'next-intl/server';
|
|
import {notFound} from 'next/navigation';
|
|
import {routing} from '@/i18n/routing';
|
|
|
|
const playfairDisplay = Playfair_Display({
|
|
variable: "--font-serif",
|
|
subsets: ["latin"],
|
|
weight: ["400", "600", "700"],
|
|
style: ["normal", "italic"],
|
|
});
|
|
|
|
const notoSerifSC = Noto_Serif_SC({
|
|
variable: "--font-serif-sc",
|
|
subsets: ["latin"],
|
|
weight: ["300", "400", "500", "700"],
|
|
});
|
|
|
|
export async function generateMetadata({
|
|
params
|
|
}: {
|
|
params: Promise<{locale: string}>;
|
|
}): Promise<Metadata> {
|
|
const { locale } = await params;
|
|
const t = await getTranslations({locale, namespace: 'Metadata'});
|
|
const baseUrl = 'https://feietech.com'; // 请替换为您的实际域名
|
|
|
|
return {
|
|
title: t('title'),
|
|
description: t('description'),
|
|
alternates: {
|
|
canonical: `${baseUrl}/${locale}`,
|
|
languages: {
|
|
'en': `${baseUrl}/en`,
|
|
'zh': `${baseUrl}/zh`,
|
|
'ja': `${baseUrl}/ja`,
|
|
},
|
|
},
|
|
openGraph: {
|
|
title: t('title'),
|
|
description: t('description'),
|
|
url: `${baseUrl}/${locale}`,
|
|
siteName: 'Nanjing Feie Information Technology',
|
|
locale: locale,
|
|
type: 'website',
|
|
images: [
|
|
{
|
|
url: `${baseUrl}/icon.jpg`,
|
|
width: 1184,
|
|
height: 1184,
|
|
alt: 'Nanjing Feie Information Technology Logo',
|
|
},
|
|
],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: Promise<{locale: string}>;
|
|
}) {
|
|
const { locale } = await params;
|
|
if (!['en', 'zh', 'ja'].includes(locale)) {
|
|
notFound();
|
|
}
|
|
|
|
const messages = await getMessages();
|
|
const baseUrl = 'https://feietech.com'; // 请替换为您的实际域名
|
|
|
|
const jsonLd = {
|
|
'@context': 'https://schema.org',
|
|
'@type': 'Organization',
|
|
name: 'Nanjing Feie Information Technology Co., Ltd.',
|
|
url: baseUrl,
|
|
logo: `${baseUrl}/assets/logo.png`,
|
|
contactPoint: {
|
|
'@type': 'ContactPoint',
|
|
telephone: '+86-198-4456-1014',
|
|
contactType: 'customer service',
|
|
areaServed: ['CN', 'US', 'JP'],
|
|
availableLanguage: ['Chinese', 'English', 'Japanese']
|
|
}
|
|
};
|
|
|
|
return (
|
|
<html lang={locale}>
|
|
<body
|
|
className={`${playfairDisplay.variable} ${notoSerifSC.variable} antialiased selection:bg-feie-gold selection:text-white`}
|
|
>
|
|
<script
|
|
type="application/ld+json"
|
|
dangerouslySetInnerHTML={{__html: JSON.stringify(jsonLd)}}
|
|
/>
|
|
<NextIntlClientProvider messages={messages}>
|
|
<Navbar />
|
|
{children}
|
|
<Footer />
|
|
</NextIntlClientProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|