Files
shopify-template/app/policies/[handle]/page.tsx
T
Rami BitarandClaude Opus 5 ff4adba2fb Render the header and footer from the root layout
Every page was importing Header and Footer and repeating the same store
name, logo, copyright and nav links. Hoisting both into the root layout
renders them once, and a new config/site.ts holds the values they shared.

The body becomes a flex column so the footer sits at the bottom of short
pages. not-found and error now render inside that chrome, so their
full-viewport centering drops to 60vh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D1vsTA4MX6qFd7nqSAKtdV
2026-08-05 15:03:44 -04:00

48 lines
1.1 KiB
TypeScript

import { notFound } from 'next/navigation';
import { getShopPolicy, POLICY_HANDLES } from '@/hooks/use-shopify-policies';
export function generateStaticParams() {
return POLICY_HANDLES.map((handle) => ({ handle }));
}
export async function generateMetadata({
params,
}: {
params: Promise<{ handle: string }>;
}) {
const { handle } = await params;
const policy = await getShopPolicy(handle);
return {
title: policy ? `${policy.title} — Shop` : 'Policy — Shop',
};
}
export default async function PolicyPage({
params,
}: {
params: Promise<{ handle: string }>;
}) {
const { handle } = await params;
const policy = await getShopPolicy(handle);
if (!policy) {
notFound();
}
return (
<main className="max-w-screen-2xl mx-auto w-full px-5 lg:px-10 py-16">
<div className="max-w-2xl mx-auto">
<h1 className="text-3xl md:text-4xl font-normal text-foreground">
{policy.title}
</h1>
<div
className="policy-body mt-8 text-[15px] leading-7 text-foreground"
dangerouslySetInnerHTML={{ __html: policy.body }}
/>
</div>
</main>
);
}