Files
movie-advisor/app/(site)/popular/page.tsx
T
nerandClaude Opus 5 0186c793f2 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>
2026-08-14 11:23:00 +03:00

56 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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: `${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();
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)}>
{Boolean(shows?.length) && <JsonLd data={itemList(shows!)} />}
<h1 className='sr-only'>{HEADING}</h1>
<Container />
</HydrationBoundary>
);
};
export const revalidate = 3600;
export default Popular;