feat(seo): heading structure + SSR person profile
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b64f137f1
commit
cd34f4eb5f
9 files changed
+30
-7
No files matched your search
@@ -11,7 +11,12 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Favorites = () => {
|
const Favorites = () => {
|
||||||
return <UsersList list='favorite' label='favorites' />;
|
return (
|
||||||
|
<>
|
||||||
|
<h1 className='sr-only'>My Favorite Shows</h1>
|
||||||
|
<UsersList list='favorite' label='favorites' />
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Favorites;
|
export default Favorites;
|
||||||
@@ -11,7 +11,12 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const WatchList = async () => {
|
const WatchList = async () => {
|
||||||
return <UsersList list='watchlist' label='watchlist' />;
|
return (
|
||||||
|
<>
|
||||||
|
<h1 className='sr-only'>My Watchlist</h1>
|
||||||
|
<UsersList list='watchlist' label='watchlist' />
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default WatchList;
|
export default WatchList;
|
||||||
@@ -2,6 +2,7 @@ import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
|
|||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
import randomQuery, { generatePage } from '@/data/queries/random';
|
import randomQuery, { generatePage } from '@/data/queries/random';
|
||||||
|
import { TITLE } from '@/env';
|
||||||
import getQueryClient from '@/lib/queryClient';
|
import getQueryClient from '@/lib/queryClient';
|
||||||
|
|
||||||
import Container from './container';
|
import Container from './container';
|
||||||
@@ -19,6 +20,7 @@ const Random = async () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||||
|
<h1 className='sr-only'>{TITLE} — Discover Your Next Favorite Movie</h1>
|
||||||
<Container page={page} />
|
<Container page={page} />
|
||||||
</HydrationBoundary>
|
</HydrationBoundary>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ const Container: FC<Props> = ({ showId, showType }) => (
|
|||||||
<div className='flex flex-1 flex-col'>
|
<div className='flex flex-1 flex-col'>
|
||||||
<div className='xs:mb-4'>
|
<div className='xs:mb-4'>
|
||||||
<Preview
|
<Preview
|
||||||
|
heading
|
||||||
showId={showId}
|
showId={showId}
|
||||||
showType={showType}
|
showType={showType}
|
||||||
className='rounded-lg bg-background'
|
className='rounded-lg bg-background'
|
||||||
|
|||||||
@@ -41,7 +41,11 @@ export const generateMetadata = async ({ params: { id } }: Props): Promise<Metad
|
|||||||
const PersonPage: FC<Props> = async ({ params: { id } }) => {
|
const PersonPage: FC<Props> = async ({ params: { id } }) => {
|
||||||
const queryClient = getQueryClient();
|
const queryClient = getQueryClient();
|
||||||
|
|
||||||
queryClient.prefetchQuery(personQuery({ personId: id }));
|
try {
|
||||||
|
await queryClient.fetchQuery(personQuery({ personId: id }));
|
||||||
|
} catch (_) {
|
||||||
|
return notFound();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const Popular = async () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||||
|
<h1 className='sr-only'>Popular Movies</h1>
|
||||||
<Container />
|
<Container />
|
||||||
</HydrationBoundary>
|
</HydrationBoundary>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const Top = async () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||||
|
<h1 className='sr-only'>Top Rated Movies</h1>
|
||||||
<Container />
|
<Container />
|
||||||
</HydrationBoundary>
|
</HydrationBoundary>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const Person: FC<Props> = ({ personId }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className='flex grow flex-col bg-background'>
|
<div className='flex grow flex-col bg-background'>
|
||||||
<span className='mb-4 text-3xl'>{profile.name}</span>
|
<h1 className='mb-4 text-3xl'>{profile.name}</h1>
|
||||||
|
|
||||||
<div className='mb-4 flex w-full flex-wrap gap-5 whitespace-nowrap text-sm'>
|
<div className='mb-4 flex w-full flex-wrap gap-5 whitespace-nowrap text-sm'>
|
||||||
{Boolean(profile.department) && <span>{profile.department}</span>}
|
{Boolean(profile.department) && <span>{profile.department}</span>}
|
||||||
@@ -52,7 +52,7 @@ const Person: FC<Props> = ({ personId }) => {
|
|||||||
|
|
||||||
{Boolean(profile.shows.length) && (
|
{Boolean(profile.shows.length) && (
|
||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
<span className='mb-3 inline-block text-lg'>Filmography</span>
|
<h2 className='mb-3 inline-block text-lg'>Filmography</h2>
|
||||||
<List shows={profile.shows} />
|
<List shows={profile.shows} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ interface Props {
|
|||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
poster?: ReactNode;
|
poster?: ReactNode;
|
||||||
externalLink?: boolean;
|
externalLink?: boolean;
|
||||||
|
heading?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Preview: FC<Props> = ({
|
const Preview: FC<Props> = ({
|
||||||
@@ -32,7 +33,8 @@ const Preview: FC<Props> = ({
|
|||||||
posterClassName,
|
posterClassName,
|
||||||
onClose,
|
onClose,
|
||||||
poster,
|
poster,
|
||||||
externalLink = true
|
externalLink = true,
|
||||||
|
heading = false
|
||||||
}) => {
|
}) => {
|
||||||
const { data: detailedShow } = useDetails({ showId: showId || baseShow?.id, showType: showType || baseShow?.type });
|
const { data: detailedShow } = useDetails({ showId: showId || baseShow?.id, showType: showType || baseShow?.type });
|
||||||
|
|
||||||
@@ -42,6 +44,8 @@ const Preview: FC<Props> = ({
|
|||||||
|
|
||||||
const isModal = Boolean(onClose);
|
const isModal = Boolean(onClose);
|
||||||
|
|
||||||
|
const Title = heading ? 'h1' : 'span';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
@@ -52,7 +56,7 @@ const Preview: FC<Props> = ({
|
|||||||
>
|
>
|
||||||
{poster || <Poster className={cn('mx-auto md:rounded-none md:rounded-l-xl', posterClassName)} show={show} />}
|
{poster || <Poster className={cn('mx-auto md:rounded-none md:rounded-l-xl', posterClassName)} show={show} />}
|
||||||
<div className={cn('flex grow flex-col bg-background', { 'p-0 pt-2 md:p-2': isModal })}>
|
<div className={cn('flex grow flex-col bg-background', { 'p-0 pt-2 md:p-2': isModal })}>
|
||||||
<span className='order-3 mb-4 text-3xl md:order-1 md:line-clamp-2'>{show.title}</span>
|
<Title className='order-3 mb-4 text-3xl md:order-1 md:line-clamp-2'>{show.title}</Title>
|
||||||
|
|
||||||
<div className='order-3 mb-4 flex w-full flex-wrap items-center gap-5 whitespace-nowrap text-sm md:order-2'>
|
<div className='order-3 mb-4 flex w-full flex-wrap items-center gap-5 whitespace-nowrap text-sm md:order-2'>
|
||||||
{Boolean(show.availability) ? <YearHint show={show} /> : <span>{new Date(show.release).getFullYear()}</span>}
|
{Boolean(show.availability) ? <YearHint show={show} /> : <span>{new Date(show.release).getFullYear()}</span>}
|
||||||
|
|||||||
Reference in new issue
Block a user