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 = () => {
|
||||
return <UsersList list='favorite' label='favorites' />;
|
||||
return (
|
||||
<>
|
||||
<h1 className='sr-only'>My Favorite Shows</h1>
|
||||
<UsersList list='favorite' label='favorites' />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Favorites;
|
||||
@@ -11,7 +11,12 @@ export const metadata: Metadata = {
|
||||
};
|
||||
|
||||
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;
|
||||
@@ -2,6 +2,7 @@ import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
|
||||
import { Metadata } from 'next';
|
||||
|
||||
import randomQuery, { generatePage } from '@/data/queries/random';
|
||||
import { TITLE } from '@/env';
|
||||
import getQueryClient from '@/lib/queryClient';
|
||||
|
||||
import Container from './container';
|
||||
@@ -19,6 +20,7 @@ const Random = async () => {
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<h1 className='sr-only'>{TITLE} — Discover Your Next Favorite Movie</h1>
|
||||
<Container page={page} />
|
||||
</HydrationBoundary>
|
||||
);
|
||||
|
||||
@@ -12,6 +12,7 @@ const Container: FC<Props> = ({ showId, showType }) => (
|
||||
<div className='flex flex-1 flex-col'>
|
||||
<div className='xs:mb-4'>
|
||||
<Preview
|
||||
heading
|
||||
showId={showId}
|
||||
showType={showType}
|
||||
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 queryClient = getQueryClient();
|
||||
|
||||
queryClient.prefetchQuery(personQuery({ personId: id }));
|
||||
try {
|
||||
await queryClient.fetchQuery(personQuery({ personId: id }));
|
||||
} catch (_) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
|
||||
@@ -20,6 +20,7 @@ const Popular = async () => {
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<h1 className='sr-only'>Popular Movies</h1>
|
||||
<Container />
|
||||
</HydrationBoundary>
|
||||
);
|
||||
|
||||
@@ -20,6 +20,7 @@ const Top = async () => {
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<h1 className='sr-only'>Top Rated Movies</h1>
|
||||
<Container />
|
||||
</HydrationBoundary>
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ const Person: FC<Props> = ({ personId }) => {
|
||||
</div>
|
||||
)}
|
||||
<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'>
|
||||
{Boolean(profile.department) && <span>{profile.department}</span>}
|
||||
@@ -52,7 +52,7 @@ const Person: FC<Props> = ({ personId }) => {
|
||||
|
||||
{Boolean(profile.shows.length) && (
|
||||
<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} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -22,6 +22,7 @@ interface Props {
|
||||
onClose?: () => void;
|
||||
poster?: ReactNode;
|
||||
externalLink?: boolean;
|
||||
heading?: boolean;
|
||||
}
|
||||
|
||||
const Preview: FC<Props> = ({
|
||||
@@ -32,7 +33,8 @@ const Preview: FC<Props> = ({
|
||||
posterClassName,
|
||||
onClose,
|
||||
poster,
|
||||
externalLink = true
|
||||
externalLink = true,
|
||||
heading = false
|
||||
}) => {
|
||||
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 Title = heading ? 'h1' : 'span';
|
||||
|
||||
return (
|
||||
<div
|
||||
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} />}
|
||||
<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'>
|
||||
{Boolean(show.availability) ? <YearHint show={show} /> : <span>{new Date(show.release).getFullYear()}</span>}
|
||||
|
||||
Reference in new issue
Block a user