mirror of
https://gitlab.com/foxixus/neomovies.git
synced 2025-10-28 01:48:50 +05:00
enchance SEO for TV
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { Metadata } from 'next';
|
||||
import TVShowPage from './TVShowPage';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
import { tvShowsAPI } from '@/lib/neoApi';
|
||||
|
||||
interface PageProps {
|
||||
@@ -8,6 +11,25 @@ interface PageProps {
|
||||
searchParams: { [key: string]: string | string[] | undefined };
|
||||
}
|
||||
|
||||
// Generate SEO metadata
|
||||
export async function generateMetadata(
|
||||
props: { params: { id: string } }
|
||||
): Promise<Metadata> {
|
||||
try {
|
||||
const showId = props.params.id;
|
||||
const { data: show } = await tvShowsAPI.getTVShow(showId);
|
||||
return {
|
||||
title: `${show.name} - NeoMovies`,
|
||||
description: show.overview,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error generating TV metadata', error);
|
||||
return {
|
||||
title: 'Сериал - NeoMovies',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function getData(id: string) {
|
||||
try {
|
||||
const response = await tvShowsAPI.getTVShow(id).then(res => res.data);
|
||||
|
||||
Reference in New Issue
Block a user