mirror of
https://gitlab.com/foxixus/neomovies.git
synced 2025-10-27 17:38:50 +05:00
enchance SEO for TV
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
|
import { Metadata } from 'next';
|
||||||
import TVShowPage from './TVShowPage';
|
import TVShowPage from './TVShowPage';
|
||||||
|
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
import { tvShowsAPI } from '@/lib/neoApi';
|
import { tvShowsAPI } from '@/lib/neoApi';
|
||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
@@ -8,6 +11,25 @@ interface PageProps {
|
|||||||
searchParams: { [key: string]: string | string[] | undefined };
|
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) {
|
async function getData(id: string) {
|
||||||
try {
|
try {
|
||||||
const response = await tvShowsAPI.getTVShow(id).then(res => res.data);
|
const response = await tvShowsAPI.getTVShow(id).then(res => res.data);
|
||||||
|
|||||||
Reference in New Issue
Block a user