feat(seo): metadata API migration, canonicals, og images

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
nerandClaude Fable 5 committed 2026-08-07 17:02:20 +03:00
1 parent 8b56268430
commit 9b64f137f1
9 files changed
+71 -25

No files matched your search

+2 -1
View File
@@ -6,7 +6,8 @@ import UsersList from '../components/UsersLists';
export const metadata: Metadata = {
title: `My Favorite Shows | ${TITLE}`,
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`,
robots: { index: false }
};
const Favorites = () => {
+2 -1
View File
@@ -6,7 +6,8 @@ import UsersList from '../components/UsersLists';
export const metadata: Metadata = {
title: `My watchlist | ${TITLE}`,
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`,
robots: { index: false }
};
const WatchList = async () => {
+5
View File
@@ -1,10 +1,15 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import randomQuery, { generatePage } from '@/data/queries/random';
import getQueryClient from '@/lib/queryClient';
import Container from './container';
export const metadata: Metadata = {
alternates: { canonical: '/' }
};
const Random = async () => {
const queryClient = getQueryClient();
+9 -5
View File
@@ -3,7 +3,7 @@ import { Metadata } from 'next';
import { notFound } from 'next/navigation';
import detailsQuery from '@/data/queries/details';
import { SITE_URL, TITLE } from '@/env';
import { TITLE } from '@/env';
import getQueryClient from '@/lib/queryClient';
import Container from './container';
@@ -18,17 +18,21 @@ export const createShowMetadata =
const queryClient = getQueryClient();
try {
const { title, overview, poster } = await queryClient.fetchQuery(detailsQuery({ showId: Number(id), showType }));
const { title, overview, poster, backdrop } = await queryClient.fetchQuery(
detailsQuery({ showId: Number(id), showType })
);
return {
title: `${title} | ${TITLE}`,
description: overview,
alternates: { canonical: `/${showType}/${id}` },
openGraph: {
title,
description: overview,
images: [poster['2x']],
type: 'website',
url: `${SITE_URL}/${showType}/${id}`
siteName: TITLE,
images: [backdrop || poster['2x']],
type: showType === 'movie' ? 'video.movie' : 'video.tv_show',
url: `/${showType}/${id}`
}
};
} catch (_) {
+4 -2
View File
@@ -5,7 +5,7 @@ import { notFound } from 'next/navigation';
import Person from '@/components/Person';
import personQuery from '@/data/queries/person';
import { SITE_URL, TITLE } from '@/env';
import { TITLE } from '@/env';
import getQueryClient from '@/lib/queryClient';
interface Props {
@@ -23,12 +23,14 @@ export const generateMetadata = async ({ params: { id } }: Props): Promise<Metad
return {
title: `${name} | ${TITLE}`,
description,
alternates: { canonical: `/person/${id}` },
openGraph: {
title: name,
description,
siteName: TITLE,
images: photo ? [photo] : [],
type: 'profile',
url: `${SITE_URL}/person/${id}`
url: `/person/${id}`
}
};
} catch (_) {
+2 -1
View File
@@ -9,7 +9,8 @@ import Container from './container';
export const metadata: Metadata = {
title: `Popular Movies | ${TITLE}`,
description: `Check out the most popular movies right now on ${TITLE}. See what’s trending and don’t miss out on the latest hits.`
description: `Check out the most popular movies right now on ${TITLE}. See what’s trending and don’t miss out on the latest hits.`,
alternates: { canonical: '/popular' }
};
const Popular = async () => {
+2 -1
View File
@@ -9,7 +9,8 @@ import Container from './container';
export const metadata: Metadata = {
title: `Top Rated Movies | ${TITLE}`,
description: `Discover the top-rated movies on ${TITLE}. Find the highest-rated films and make informed viewing choices.`
description: `Discover the top-rated movies on ${TITLE}. Find the highest-rated films and make informed viewing choices.`,
alternates: { canonical: '/top' }
};
const Top = async () => {
+13 -14
View File
@@ -10,9 +10,21 @@ import Providers from '@/providers';
import '@/styles/index.css';
const DESCRIPTION = `Explore a diverse selection of movies with ${TITLE}. Get random movie recommendations and find out top-rated, popular, and user-favorite films.`;
export const metadata: Metadata = {
metadataBase: new URL(SITE_URL),
title: `${TITLE} | Discover Your Next Favorite Movie`,
description: `Explore a diverse selection of movies with ${TITLE}. Get random movie recommendations and find out top-rated, popular, and user-favorite films.`
description: DESCRIPTION,
openGraph: {
type: 'website',
siteName: TITLE,
title: TITLE,
description: DESCRIPTION
},
twitter: {
card: 'summary_large_image'
}
};
export const viewport: Viewport = {
@@ -53,19 +65,6 @@ const RootLayout = ({ children }: { children: ReactNode }) => {
<meta name='apple-mobile-web-app-title' content={TITLE} />
<link rel='manifest' href='/manifest.json' />
<meta name='twitter:card' content={metadata.description!} />
<meta name='twitter:url' content={SITE_URL} />
<meta name='twitter:title' content={TITLE} />
<meta name='twitter:description' content={metadata.description!} />
<meta name='twitter:image' content={`${SITE_URL}/web-app-manifest-512x512.png`} />
<meta name='twitter:creator' content='https://github.com/noisy5ilence' />
<meta property='og:type' content='website' />
<meta property='og:title' content={TITLE} />
<meta property='og:description' content={metadata.description!} />
<meta property='og:site_name' content={TITLE} />
<meta property='og:url' content={SITE_URL} />
<meta property='og:image' content={`${SITE_URL}/apple-touch-icon.png`} />
</head>
<body className={font.className}>
<Providers>
+32
View File
@@ -0,0 +1,32 @@
import { ImageResponse } from 'next/og';
import { TITLE } from '@/env';
export const alt = `${TITLE} | Discover Your Next Favorite Movie`;
export const size = { width: 1200, height: 630 };
export const contentType = 'image/png';
const Image = () =>
new ImageResponse(
(
<div
style={{
width: '100%',
height: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: 28,
background: 'linear-gradient(135deg, #09090b 0%, #18181b 60%, #312e38 100%)',
color: 'white'
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 28, fontSize: 96 }}>🍿 {TITLE}</div>
<div style={{ display: 'flex', fontSize: 38, color: '#a1a1aa' }}>Discover your next favorite movie</div>
</div>
),
size
);
export default Image;