34 lines
822 B
TypeScript
34 lines
822 B
TypeScript
import { ReactNode } from 'react';
|
|
import { Metadata } from 'next';
|
|
import { content } from '../../lib/content';
|
|
|
|
interface LanguageLayoutProps {
|
|
children: ReactNode;
|
|
params: {
|
|
lang: string;
|
|
};
|
|
}
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: { lang: string };
|
|
}): Promise<Metadata> {
|
|
const lang = params.lang as keyof typeof content;
|
|
const currentContent = content[lang] || content['zh-CN'];
|
|
|
|
return {
|
|
title: currentContent.title,
|
|
description: currentContent.description,
|
|
keywords: currentContent.keywords,
|
|
};
|
|
}
|
|
|
|
export default function LanguageLayout({ children, params }: LanguageLayoutProps) {
|
|
return children;
|
|
}
|
|
|
|
export async function generateStaticParams() {
|
|
return [{ lang: 'zh-CN' }, { lang: 'zh-TW' }, { lang: 'en' }];
|
|
}
|