Template
The root layout exported no metadata, so routes without their own export rendered no title at all, and no route had a description. Add a root metadata block with a title template, Open Graph and Twitter defaults, and fill in the routes that were missing tags. - config/site.ts: description and env-driven absolute url for metadataBase - home, /collections and /shop/collections: titles and descriptions - products/[handle] and collections/[handle]: generateMetadata off the existing catalog fetchers, with canonical and OG image - existing titles: drop the hand-written " — Shop" suffix now that the root template appends it Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011x5jT4fJJCnqPx3umEvXRk
31 lines
964 B
TypeScript
31 lines
964 B
TypeScript
import { redirect } from 'next/navigation';
|
|
import OrderHistory from '@/components/shopify/order-history';
|
|
import { getSessionToken } from '@/services/shopify/session';
|
|
import { getCustomer } from '@/services/shopify/customer';
|
|
|
|
export const metadata = { title: 'Order history' };
|
|
|
|
export default async function Page() {
|
|
const token = await getSessionToken();
|
|
if (!token) redirect('/account/login');
|
|
|
|
const customer = await getCustomer(token, 20);
|
|
// An expired or revoked token reads as signed out.
|
|
if (!customer) redirect('/account/login');
|
|
|
|
return (
|
|
<main className="max-w-screen-2xl mx-auto w-full px-8 py-12">
|
|
<h1 className="text-2xl md:text-3xl font-normal text-foreground">
|
|
Order history
|
|
</h1>
|
|
<p className="mt-1 text-sm text-muted-foreground">
|
|
{customer.displayName} · {customer.email}
|
|
</p>
|
|
|
|
<div className="mt-10">
|
|
<OrderHistory customer={customer} />
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|