feat(seo): crawlable card links, listing metadata, similar prefetch

Following links reached only 37 of 1873 urls and the frontier was exhausted
at depth 3, because detail pages rendered no internal links server side.

- Prefetch similar shows on detail pages so their links land in the ssr html.
  Crawl reach goes from 37 pages to 782 and keeps growing. Credits are left
  client side on purpose: dehydrating aggregate_credits pushed a series page
  from 52kb to 600kb to surface only ten person links.
- Replace the aria-label on poster links with sr-only text, so the anchors
  carry real anchor text instead of being empty. Text content is also a
  better accessible name than aria-label.
- Give popular and top their own openGraph and twitter tags. They inherited
  the generic homepage title and description.
- Add og:image:alt on movie, tv and person pages.
- Add ItemList json-ld to the listing pages.
- Drop favorites, watchlist and opengraph-image from the sitemap, and remove
  the robots.txt disallow that kept crawlers from reading their noindex.
- Raise detail revalidate to a week. Cast and release dates barely move, and
  it cuts regenerations, isr writes and origin transfer sevenfold now that
  more pages get crawled.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
nerandClaude Opus 5 committed 2026-08-14 11:23:00 +03:00
1 parent 01792a9669
commit 0186c793f2
9 files changed
+87 -22

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
import { createShowMetadata, createShowPage } from '../../showPage';
export const revalidate = 86400;
export const revalidate = 604800;
export const generateStaticParams = async () => [];
+4 -1
View File
@@ -4,6 +4,7 @@ import { notFound, permanentRedirect } from 'next/navigation';
import JsonLd from '@/components/JsonLd';
import detailsQuery from '@/data/queries/details';
import similarQuery from '@/data/queries/similar';
import { SITE_URL, TITLE } from '@/env';
import getQueryClient from '@/lib/queryClient';
import { isMissing, showPath } from '@/lib/utils';
@@ -36,7 +37,7 @@ export const createShowMetadata =
title,
description: overview,
siteName: TITLE,
images: [backdrop || poster['2x']],
images: [{ url: backdrop || poster['2x'], alt: title }],
type: showType === 'movie' ? 'video.movie' : 'video.tv_show',
url: path
}
@@ -68,6 +69,8 @@ export const createShowPage = (showType: Show['type']) => {
if (decodeURIComponent(`/${showType}/${id}`) !== path) permanentRedirect(path);
await queryClient.prefetchQuery(similarQuery({ showId, showType, type: 'similar' }));
const jsonLd = {
'@context': 'https://schema.org',
'@type': showType === 'movie' ? 'Movie' : 'TVSeries',
+1 -1
View File
@@ -1,6 +1,6 @@
import { createShowMetadata, createShowPage } from '../../showPage';
export const revalidate = 86400;
export const revalidate = 604800;
export const generateStaticParams = async () => [];
+2 -2
View File
@@ -14,7 +14,7 @@ interface Props {
params: { id: string };
}
export const revalidate = 86400;
export const revalidate = 604800;
export const generateStaticParams = async () => [];
@@ -34,7 +34,7 @@ export const generateMetadata = async ({ params: { id } }: Props): Promise<Metad
title: name,
description,
siteName: TITLE,
images: photo ? [photo] : [],
images: photo ? [{ url: photo, alt: name }] : [],
type: 'profile',
url: `/person/${id}`
}
+29 -5
View File
@@ -1,26 +1,50 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import JsonLd from '@/components/JsonLd';
import popularQuery from '@/data/queries/popular';
import { TITLE } from '@/env';
import { itemList } from '@/lib/jsonLd';
import getQueryClient from '@/lib/queryClient';
import Container from './container';
const HEADING = 'Popular Movies';
const DESCRIPTION = `Check out the most popular movies right now on ${TITLE}. See what’s trending and don’t miss out on the latest hits.`;
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.`,
alternates: { canonical: '/popular' }
title: `${HEADING} | ${TITLE}`,
description: DESCRIPTION,
alternates: { canonical: '/popular' },
openGraph: {
type: 'website',
siteName: TITLE,
title: HEADING,
description: DESCRIPTION,
url: '/popular'
},
twitter: {
title: HEADING,
description: DESCRIPTION
}
};
const Popular = async () => {
const queryClient = getQueryClient();
await queryClient.prefetchInfiniteQuery(popularQuery());
const query = popularQuery();
await queryClient.prefetchInfiniteQuery(query);
const shows = queryClient
.getQueryData<{ pages: Pagination<Show>[] }>(query.queryKey)
?.pages.flatMap(({ results }) => results);
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<h1 className='sr-only'>Popular Movies</h1>
{Boolean(shows?.length) && <JsonLd data={itemList(shows!)} />}
<h1 className='sr-only'>{HEADING}</h1>
<Container />
</HydrationBoundary>
);
+29 -5
View File
@@ -1,26 +1,50 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import JsonLd from '@/components/JsonLd';
import popularQuery from '@/data/queries/popular';
import { TITLE } from '@/env';
import { itemList } from '@/lib/jsonLd';
import getQueryClient from '@/lib/queryClient';
import Container from './container';
const HEADING = 'Top Rated Movies';
const DESCRIPTION = `Discover the top-rated movies on ${TITLE}. Find the highest-rated films and make informed viewing choices.`;
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.`,
alternates: { canonical: '/top' }
title: `${HEADING} | ${TITLE}`,
description: DESCRIPTION,
alternates: { canonical: '/top' },
openGraph: {
type: 'website',
siteName: TITLE,
title: HEADING,
description: DESCRIPTION,
url: '/top'
},
twitter: {
title: HEADING,
description: DESCRIPTION
}
};
const Top = async () => {
const queryClient = getQueryClient();
await queryClient.prefetchInfiniteQuery(popularQuery({ sortBy: 'vote_average.desc' }));
const query = popularQuery({ sortBy: 'vote_average.desc' });
await queryClient.prefetchInfiniteQuery(query);
const shows = queryClient
.getQueryData<{ pages: Pagination<Show>[] }>(query.queryKey)
?.pages.flatMap(({ results }) => results);
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<h1 className='sr-only'>Top Rated Movies</h1>
{Boolean(shows?.length) && <JsonLd data={itemList(shows!)} />}
<h1 className='sr-only'>{HEADING}</h1>
<Container />
</HydrationBoundary>
);