feat(seo): metadata API migration, canonicals, og images
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b56268430
commit
9b64f137f1
9 files changed
+71
-25
No files matched your search
@@ -6,7 +6,8 @@ import UsersList from '../components/UsersLists';
|
|||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `My Favorite Shows | ${TITLE}`,
|
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 = () => {
|
const Favorites = () => {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import UsersList from '../components/UsersLists';
|
|||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `My watchlist | ${TITLE}`,
|
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 () => {
|
const WatchList = async () => {
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
|
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
|
||||||
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
import randomQuery, { generatePage } from '@/data/queries/random';
|
import randomQuery, { generatePage } from '@/data/queries/random';
|
||||||
import getQueryClient from '@/lib/queryClient';
|
import getQueryClient from '@/lib/queryClient';
|
||||||
|
|
||||||
import Container from './container';
|
import Container from './container';
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
alternates: { canonical: '/' }
|
||||||
|
};
|
||||||
|
|
||||||
const Random = async () => {
|
const Random = async () => {
|
||||||
const queryClient = getQueryClient();
|
const queryClient = getQueryClient();
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Metadata } from 'next';
|
|||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
|
|
||||||
import detailsQuery from '@/data/queries/details';
|
import detailsQuery from '@/data/queries/details';
|
||||||
import { SITE_URL, TITLE } from '@/env';
|
import { TITLE } from '@/env';
|
||||||
import getQueryClient from '@/lib/queryClient';
|
import getQueryClient from '@/lib/queryClient';
|
||||||
|
|
||||||
import Container from './container';
|
import Container from './container';
|
||||||
@@ -18,17 +18,21 @@ export const createShowMetadata =
|
|||||||
const queryClient = getQueryClient();
|
const queryClient = getQueryClient();
|
||||||
|
|
||||||
try {
|
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 {
|
return {
|
||||||
title: `${title} | ${TITLE}`,
|
title: `${title} | ${TITLE}`,
|
||||||
description: overview,
|
description: overview,
|
||||||
|
alternates: { canonical: `/${showType}/${id}` },
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title,
|
title,
|
||||||
description: overview,
|
description: overview,
|
||||||
images: [poster['2x']],
|
siteName: TITLE,
|
||||||
type: 'website',
|
images: [backdrop || poster['2x']],
|
||||||
url: `${SITE_URL}/${showType}/${id}`
|
type: showType === 'movie' ? 'video.movie' : 'video.tv_show',
|
||||||
|
url: `/${showType}/${id}`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { notFound } from 'next/navigation';
|
|||||||
|
|
||||||
import Person from '@/components/Person';
|
import Person from '@/components/Person';
|
||||||
import personQuery from '@/data/queries/person';
|
import personQuery from '@/data/queries/person';
|
||||||
import { SITE_URL, TITLE } from '@/env';
|
import { TITLE } from '@/env';
|
||||||
import getQueryClient from '@/lib/queryClient';
|
import getQueryClient from '@/lib/queryClient';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -23,12 +23,14 @@ export const generateMetadata = async ({ params: { id } }: Props): Promise<Metad
|
|||||||
return {
|
return {
|
||||||
title: `${name} | ${TITLE}`,
|
title: `${name} | ${TITLE}`,
|
||||||
description,
|
description,
|
||||||
|
alternates: { canonical: `/person/${id}` },
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title: name,
|
title: name,
|
||||||
description,
|
description,
|
||||||
|
siteName: TITLE,
|
||||||
images: photo ? [photo] : [],
|
images: photo ? [photo] : [],
|
||||||
type: 'profile',
|
type: 'profile',
|
||||||
url: `${SITE_URL}/person/${id}`
|
url: `/person/${id}`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import Container from './container';
|
|||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `Popular Movies | ${TITLE}`,
|
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 () => {
|
const Popular = async () => {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import Container from './container';
|
|||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `Top Rated Movies | ${TITLE}`,
|
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 () => {
|
const Top = async () => {
|
||||||
|
|||||||
+13
-14
@@ -10,9 +10,21 @@ import Providers from '@/providers';
|
|||||||
|
|
||||||
import '@/styles/index.css';
|
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 = {
|
export const metadata: Metadata = {
|
||||||
|
metadataBase: new URL(SITE_URL),
|
||||||
title: `${TITLE} | Discover Your Next Favorite Movie`,
|
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 = {
|
export const viewport: Viewport = {
|
||||||
@@ -53,19 +65,6 @@ const RootLayout = ({ children }: { children: ReactNode }) => {
|
|||||||
<meta name='apple-mobile-web-app-title' content={TITLE} />
|
<meta name='apple-mobile-web-app-title' content={TITLE} />
|
||||||
|
|
||||||
<link rel='manifest' href='/manifest.json' />
|
<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>
|
</head>
|
||||||
<body className={font.className}>
|
<body className={font.className}>
|
||||||
<Providers>
|
<Providers>
|
||||||
|
|||||||
@@ -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;
|
||||||
Reference in new issue
Block a user