seo优化
This commit is contained in:
+65
-5
@@ -4,8 +4,9 @@ import "../globals.css";
|
||||
import Navbar from "@/components/Navbar";
|
||||
import Footer from "@/components/Footer";
|
||||
import {NextIntlClientProvider} from 'next-intl';
|
||||
import {getMessages} from 'next-intl/server';
|
||||
import {getMessages, getTranslations} from 'next-intl/server';
|
||||
import {notFound} from 'next/navigation';
|
||||
import {routing} from '@/i18n/routing';
|
||||
|
||||
const playfairDisplay = Playfair_Display({
|
||||
variable: "--font-serif",
|
||||
@@ -20,10 +21,49 @@ const notoSerifSC = Noto_Serif_SC({
|
||||
weight: ["300", "400", "500", "700"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "南京市肥鹅信息技术有限公司 | Nanjing Feie Information Technology",
|
||||
description: "南京市肥鹅信息技术有限公司致力于为企业提供卓越的数字化解决方案,以创新技术驱动商业价值。",
|
||||
};
|
||||
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',
|
||||
},
|
||||
],
|
||||
},
|
||||
icons: {
|
||||
icon: '/icon.jpg',
|
||||
shortcut: '/icon.jpg',
|
||||
apple: '/icon.jpg',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default async function LocaleLayout({
|
||||
children,
|
||||
@@ -38,12 +78,32 @@ export default async function LocaleLayout({
|
||||
}
|
||||
|
||||
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}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import {MetadataRoute} from 'next';
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
const baseUrl = 'https://feietech.com';
|
||||
return {
|
||||
rules: {
|
||||
userAgent: '*',
|
||||
allow: '/',
|
||||
disallow: '/private/',
|
||||
},
|
||||
sitemap: `${baseUrl}/sitemap.xml`,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import {MetadataRoute} from 'next';
|
||||
import {routing} from '@/i18n/routing';
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = 'https://feietech.com';
|
||||
|
||||
// 基础路由,这里只有首页
|
||||
const routes = [''];
|
||||
|
||||
return routes.flatMap((route) => {
|
||||
return routing.locales.map((locale) => {
|
||||
return {
|
||||
url: `${baseUrl}/${locale}${route}`,
|
||||
lastModified: new Date(),
|
||||
changeFrequency: 'weekly',
|
||||
priority: route === '' ? 1 : 0.8,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user