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
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
import type { Metadata } from 'next';
|
|
import './globals.css';
|
|
import { Geist, Geist_Mono } from 'next/font/google';
|
|
import Header from '@/components/shopify/header';
|
|
import Footer from '@/components/shopify/footer';
|
|
import StoreAssistant from '@/components/shopify/store-assistant';
|
|
import { site } from '@/config/site';
|
|
|
|
const geist = Geist({
|
|
subsets: ['latin'],
|
|
variable: '--font-geist-sans',
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
subsets: ['latin'],
|
|
variable: '--font-geist-mono',
|
|
});
|
|
|
|
// Routes only set their own `title`; the template appends the store name, and
|
|
// everything else here is inherited unless a page overrides it.
|
|
export const metadata: Metadata = {
|
|
metadataBase: new URL(site.url),
|
|
title: {
|
|
default: site.storeName,
|
|
template: `%s — ${site.storeName}`,
|
|
},
|
|
description: site.description,
|
|
openGraph: {
|
|
type: 'website',
|
|
siteName: site.storeName,
|
|
title: site.storeName,
|
|
description: site.description,
|
|
url: '/',
|
|
},
|
|
twitter: {
|
|
card: 'summary_large_image',
|
|
title: site.storeName,
|
|
description: site.description,
|
|
},
|
|
};
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
return (
|
|
<html lang="en" className={`${geist.variable} ${geistMono.variable}`}>
|
|
<body className="font-body antialiased bg-background text-foreground m-0 p-0 flex min-h-screen flex-col">
|
|
{/* Header owns the cart drawer, search and account menu, so every
|
|
route gets them by rendering here rather than page by page. */}
|
|
<Header
|
|
storeName={site.storeName}
|
|
logoUrl={site.logoUrl}
|
|
links={site.navLinks}
|
|
/>
|
|
<div className="flex-1">{children}</div>
|
|
<Footer storeName={site.storeName} copyright={site.copyright} />
|
|
<StoreAssistant />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|