Files
Podcast-Generator/web/src/app/[lang]/podcast/[fileName]/page.tsx
hex2077 f64cd498cf feat: 添加日语支持并优化国际化功能
refactor: 重构中间件和路由处理逻辑
fix: 修复音频示例API的错误处理
docs: 更新README和DOCKER_USAGE文档
style: 优化语言切换器样式
chore: 更新.gitignore添加生产环境配置文件
2025-08-25 19:17:16 +08:00

37 lines
1.3 KiB
TypeScript

import { Metadata } from 'next';
import PodcastContent from '@/components/PodcastContent';
import { useTranslation } from '../../../../i18n'; // 导入 useTranslation
import { headers } from 'next/headers';
import { getTruePathFromHeaders } from '../../../../lib/utils';
export async function generateMetadata({ params }: PodcastDetailPageProps): Promise<Metadata> {
const { fileName, lang } = await params;
const { t } = await useTranslation(lang);
const decodedFileName = decodeURIComponent(fileName);
const title = `${t('podcastContent.podcastDetails')} - ${decodedFileName}`;
const description = `${t('podcastContent.listenToPodcast')} ${decodedFileName}`;
const truePath = await getTruePathFromHeaders(await headers(), lang);
return {
title,
description,
alternates: {
canonical: `${truePath}/podcast/${decodedFileName}`,
},
};
}
interface PodcastDetailPageProps {
params: {
fileName: string;
lang: string; // 添加 lang 属性
};
}
export default async function PodcastDetailPage({ params }: PodcastDetailPageProps) {
const { fileName, lang } = await params; // 解构 lang
return (
<div className="bg-white text-gray-800 font-sans">
<PodcastContent fileName={decodeURIComponent(fileName)} lang={lang} />
</div>
);
}