Next.js 15 多品牌多域名 SEO 与国际化治理概述在多品牌场景下,品牌域名与区域语言需协同。本文给出域名映射、国际化路由、分片 sitemap 与 canonical/hreflang 的一体化治理方案。域名与语言映射export default {
i18n: {
locales: ['en-US', 'zh-CN', 'ja-JP'],
defaultLocale: 'en-US',
domains: [
{ domain: 'brand-a.com', defaultLocale: 'en-US' },
{ domain: 'brand-a.cn', defaultLocale: 'zh-CN' },
{ domain: 'brand-b.com', defaultLocale: 'en-US' }
]
}
}
canonical 与 hreflangimport type { Metadata } from 'next'
export async function generateMetadata({ params }: { params: { locale: string; slug: string } }): Promise<Metadata> {
const hosts = { 'en-US': 'https://brand-a.com', 'zh-CN': 'https://brand-a.cn', 'ja-JP': 'https://brand-b.com' }
const canonical = `${hosts[params.locale]}/${params.locale}/${params.slug}`
return {
alternates: {
canonical,
languages: {
'en-US': canonical.replace(hosts[params.locale], hosts['en-US']).replace(params.locale, 'en-US'),
'zh-CN': canonical.replace(hosts[params.locale], hosts['zh-CN']).replace(params.locale, 'zh-CN'),
'ja-JP': canonical.replace(hosts[params.locale], hosts['ja-JP']).replace(params.locale, 'ja-JP')
}
}
}
}
分片 sitemapimport type { MetadataRoute } from 'next'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const brands = [{ host: 'https://brand-a.com', locale: 'en-US' }, { host: 'https://brand-a.cn', locale: 'zh-CN' }, { host: 'https://brand-b.com', locale: 'ja-JP' }]
const pages = await fetch('https://api.example.com/pages').then((r) => r.json()) as Array<{ slug: string; lastmod?: string }>
const entries: MetadataRoute.Sitemap = []
for (const brand of brands) {
for (const p of pages) {
entries.push({ url: `${brand.host}/${brand.locale}/${p.slug}`, lastModified: p.lastmod ?? new Date(), changeFrequency: 'weekly', priority: 0.8 })
}
}
return entries
}
robots 协同import type { MetadataRoute } from 'next'
export default function robots(): MetadataRoute.Robots {
return { rules: [{ userAgent: '*', allow: '/', disallow: ['/admin'] }], sitemap: ['https://brand-a.com/sitemap.xml', 'https://brand-a.cn/sitemap.xml', 'https://brand-b.com/sitemap.xml'] }
}
技术参数与验证站长工具提交三域名 sitemap;地域与语言版本互相标注。收录稳定提升;重复内容告警下降。应用场景多品牌出海;区域运营与本地化。注意事项canonical 必须唯一指向品牌域主版本;确保 hreflang 完整覆盖。robots 在各域名保持一致策略或按区域差异化。常见问题Q: 是否需要品牌独立项目?A: 可由单项目多域名承载,依配置映射与分片输出实现治理。参考资料Next.js Metadata、Sitemap 与多域名国际化指南。---发布信息:已发布 · 技术验证 · 阅读 38 分钟 · CC BY-SA 4.0

发表评论 取消回复