pagepublishedmdai-assisted
Three Pages With No Title Tag (And Why I'm Leaving Them That Way For Now)
I wired up page title metadata across the whole site — except for three pages that use 'use client'. I know the fix. I don't want to do it yet. Here's everything documented so I can come back to it.
- Path
/projects/jaygriff-v2/notes/client-component-page-title-debt- Published
- May 7, 2026
- Revised
- —
- Project
- jaygriff-v2
- Tags
On this page
Stored toc, derived from the body's headings on save. The body below isn't rendered yet, so these show the anchor ids rather than linking to them.
- What I Was Doing
#what-i-was-doing - The Problem: Three Client Pages Have No Titles
#the-problem-three-client-pages-have-no-titles - The Bandaid I Considered (And Didn't Do)
#the-bandaid-i-considered-and-didnt-do - What To Do When I Come Back To This
#what-to-do-when-i-come-back-to-this
Body
markdownbody.md
---json
{
"title": "Three Pages With No Title Tag (And Why I'm Leaving Them That Way For Now)",
"slug": "client-component-page-title-debt",
"date": "2026-03-01T00:00:00Z",
"author": ["Jay Griffin", "Claude Sonnet 4.6"],
"authorshipNote": "Claude Sonnet 4.6 via GitHub Copilot",
"description": "I wired up page title metadata across the whole site — except for three pages that use 'use client'. I know the fix. I don't want to do it yet. Here's everything documented so I can come back to it.",
"type": "doc",
"tags": ["next.js", "metadata", "tech-debt", "client-components", "seo"],
"projectId": "jaygriff",
"relatedPosts": ["seo-optimization-plan"]
}
---
## What I Was Doing
This is a lot of infrastructure for what amounts to a browser tab title. But the point is that once it's set up it's fully automatic — any new server component page just exports one line and gets the right title, and dynamic routes like `/posts/[slug]` resolve titles from content metadata with no manual work. Three pages are still broken because I put `'use client'` at the top of the whole file instead of scoping it properly. That's the real story here.
I wired up full page title metadata across jaygriff.com so every page shows `Page Title | Jay Griffin` in the browser tab and search results.
The setup:
**`src/app/layout.tsx`** — title template:
```tsx
export const metadata = {
title: {
default: 'Jay Griffin',
template: '%s | Jay Griffin',
},
// ...
};
```
**Server component pages** — just export metadata:
```tsx
export const metadata = { title: routeMetadata.title, description: routeMetadata.description };
```
**Dynamic routes** (`posts/[slug]`, `docs/[slug]`) — use `generateMetadata`:
```tsx
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const content = await loadContentBySlug(slug, 'post');
if (!content) return {};
return {
title: content.metadata.title,
description: content.metadata.description,
};
}
```
This works fine for all the server component routes.
---
## The Problem: Three Client Pages Have No Titles
Three app routes are `'use client'` components:
- `/about-me` — `src/app/about-me/page.tsx` — uses `useState` for the FAQ accordion
- `/projects` — `src/app/projects/page.tsx` — gallery interaction
- `/my-stack` — `src/app/my-stack/page.tsx` — filter/tool card interaction
Next.js does not allow `export const metadata` (or `generateMetadata`) in `'use client'` components. It silently ignores it. These three pages currently show just `Jay Griffin` in the tab with no page-specific title.
---
## The Bandaid I Considered (And Didn't Do)
The quick fix is a **thin server wrapper**. Create a new server `page.tsx` that exports metadata and re-exports the default component from a renamed file.
Steps for each page:
1. Rename `page.tsx` → `AboutMePage.tsx` (preserving the `'use client'` directive and all logic)
2. Create a new `page.tsx` (server component):
```tsx
// src/app/about-me/page.tsx (NEW - server component)
import type { Metadata } from 'next';
export const metadata: Metadata = {
title: 'About Me',
description: 'Full-stack developer. React, Next.js, TypeScript.',
};
export { default } from './AboutMePage';
```
The routing stays identical. Next.js picks up the metadata from the server wrapper. The client component renders as normal.
**Why it would work:**
- No changes to component logic at all
- Routes, navigation, `getAllRoutes()`, sitemap — none of that breaks. The route discovery system only scans the filesystem for posts/docs slugs, it doesn't import from app route `page.tsx` files.
- `theme-editor/page.tsx` already uses this exact pattern (it imports `ThemeEditorPage` from a separate file) — so it's proven in the codebase
**Why I'm not doing it right now:**
I don't like this pattern. It creates a file just to be a pass-through. The real problem is that `'use client'` is at the top of the whole page file when it only needs to be on the interactive parts. Wrapping it papers over that design issue instead of fixing it.
The proper fix is to push `'use client'` down the component tree:
- `about-me`: The accordion open/close state is the only interactive thing. The `Accordion.Root` and the `useState` can live in a small `<FAQAccordion>` client component. The outer `page.tsx` becomes a server component.
- `projects`: Gallery interaction (hover states, click handlers) can be pushed into `ProjectGallery` itself, which is already its own component. Page can likely become server.
- `my-stack`: Filter state goes into a `<StackFilter>` client component. Page goes server.
This is the right move — but it's also a real refactor for each page, and I'd rather do it as part of the Tailwind + shadcn stack migration where I'm touching all these components anyway.
---
## What To Do When I Come Back To This
For each of the three pages, the plan is:
1. Identify the specific interactive state (accordion, hover, filter)
2. Extract that state + the interactive JSX into a new `ClientComponent.tsx` with `'use client'`
3. Convert `page.tsx` to a server component
4. Add `export const metadata` directly to `page.tsx`
5. No wrapper files needed
Or, if I want to be fast about it and just ship title tags now, the thin wrapper works and can be cleaned up later. But I'd rather wait.Raw row
jsonclient-component-page-title-debt.json
{
"id": "cdfc001a-af69-48c5-8cce-4ba5d7d83574",
"parentId": "383caad1-85de-490c-a6c6-47d95519b574",
"slug": "client-component-page-title-debt",
"path": "/projects/jaygriff-v2/notes/client-component-page-title-debt",
"type": "page",
"status": "published",
"title": "Three Pages With No Title Tag (And Why I'm Leaving Them That Way For Now)",
"description": "I wired up page title metadata across the whole site — except for three pages that use 'use client'. I know the fix. I don't want to do it yet. Here's everything documented so I can come back to it.",
"intro": null,
"body": "---json\n{\n \"title\": \"Three Pages With No Title Tag (And Why I'm Leaving Them That Way For Now)\",\n \"slug\": \"client-component-page-title-debt\",\n \"date\": \"2026-03-01T00:00:00Z\",\n \"author\": [\"Jay Griffin\", \"Claude Sonnet 4.6\"],\n \"authorshipNote\": \"Claude Sonnet 4.6 via GitHub Copilot\",\n \"description\": \"I wired up page title metadata across the whole site — except for three pages that use 'use client'. I know the fix. I don't want to do it yet. Here's everything documented so I can come back to it.\",\n \"type\": \"doc\",\n \"tags\": [\"next.js\", \"metadata\", \"tech-debt\", \"client-components\", \"seo\"],\n \"projectId\": \"jaygriff\",\n \"relatedPosts\": [\"seo-optimization-plan\"]\n}\n---\n\n## What I Was Doing\n\nThis is a lot of infrastructure for what amounts to a browser tab title. But the point is that once it's set up it's fully automatic — any new server component page just exports one line and gets the right title, and dynamic routes like `/posts/[slug]` resolve titles from content metadata with no manual work. Three pages are still broken because I put `'use client'` at the top of the whole file instead of scoping it properly. That's the real story here.\n\nI wired up full page title metadata across jaygriff.com so every page shows `Page Title | Jay Griffin` in the browser tab and search results.\n\nThe setup:\n\n**`src/app/layout.tsx`** — title template:\n```tsx\nexport const metadata = {\n title: {\n default: 'Jay Griffin',\n template: '%s | Jay Griffin',\n },\n // ...\n};\n```\n\n**Server component pages** — just export metadata:\n```tsx\nexport const metadata = { title: routeMetadata.title, description: routeMetadata.description };\n```\n\n**Dynamic routes** (`posts/[slug]`, `docs/[slug]`) — use `generateMetadata`:\n```tsx\nexport async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {\n const { slug } = await params;\n const content = await loadContentBySlug(slug, 'post');\n if (!content) return {};\n return {\n title: content.metadata.title,\n description: content.metadata.description,\n };\n}\n```\n\nThis works fine for all the server component routes.\n\n---\n\n## The Problem: Three Client Pages Have No Titles\n\nThree app routes are `'use client'` components:\n\n- `/about-me` — `src/app/about-me/page.tsx` — uses `useState` for the FAQ accordion\n- `/projects` — `src/app/projects/page.tsx` — gallery interaction\n- `/my-stack` — `src/app/my-stack/page.tsx` — filter/tool card interaction\n\nNext.js does not allow `export const metadata` (or `generateMetadata`) in `'use client'` components. It silently ignores it. These three pages currently show just `Jay Griffin` in the tab with no page-specific title.\n\n---\n\n## The Bandaid I Considered (And Didn't Do)\n\nThe quick fix is a **thin server wrapper**. Create a new server `page.tsx` that exports metadata and re-exports the default component from a renamed file.\n\nSteps for each page:\n1. Rename `page.tsx` → `AboutMePage.tsx` (preserving the `'use client'` directive and all logic)\n2. Create a new `page.tsx` (server component):\n\n```tsx\n// src/app/about-me/page.tsx (NEW - server component)\nimport type { Metadata } from 'next';\n\nexport const metadata: Metadata = {\n title: 'About Me',\n description: 'Full-stack developer. React, Next.js, TypeScript.',\n};\n\nexport { default } from './AboutMePage';\n```\n\nThe routing stays identical. Next.js picks up the metadata from the server wrapper. The client component renders as normal.\n\n**Why it would work:**\n- No changes to component logic at all\n- Routes, navigation, `getAllRoutes()`, sitemap — none of that breaks. The route discovery system only scans the filesystem for posts/docs slugs, it doesn't import from app route `page.tsx` files.\n- `theme-editor/page.tsx` already uses this exact pattern (it imports `ThemeEditorPage` from a separate file) — so it's proven in the codebase\n\n**Why I'm not doing it right now:**\n\nI don't like this pattern. It creates a file just to be a pass-through. The real problem is that `'use client'` is at the top of the whole page file when it only needs to be on the interactive parts. Wrapping it papers over that design issue instead of fixing it.\n\nThe proper fix is to push `'use client'` down the component tree:\n\n- `about-me`: The accordion open/close state is the only interactive thing. The `Accordion.Root` and the `useState` can live in a small `<FAQAccordion>` client component. The outer `page.tsx` becomes a server component.\n- `projects`: Gallery interaction (hover states, click handlers) can be pushed into `ProjectGallery` itself, which is already its own component. Page can likely become server.\n- `my-stack`: Filter state goes into a `<StackFilter>` client component. Page goes server.\n\nThis is the right move — but it's also a real refactor for each page, and I'd rather do it as part of the Tailwind + shadcn stack migration where I'm touching all these components anyway.\n\n---\n\n## What To Do When I Come Back To This\n\nFor each of the three pages, the plan is:\n\n1. Identify the specific interactive state (accordion, hover, filter)\n2. Extract that state + the interactive JSX into a new `ClientComponent.tsx` with `'use client'`\n3. Convert `page.tsx` to a server component\n4. Add `export const metadata` directly to `page.tsx`\n5. No wrapper files needed\n\nOr, if I want to be fast about it and just ship title tags now, the thin wrapper works and can be cleaned up later. But I'd rather wait.\n",
"toc": [
{
"depth": 2,
"text": "What I Was Doing",
"id": "what-i-was-doing"
},
{
"depth": 2,
"text": "The Problem: Three Client Pages Have No Titles",
"id": "the-problem-three-client-pages-have-no-titles"
},
{
"depth": 2,
"text": "The Bandaid I Considered (And Didn't Do)",
"id": "the-bandaid-i-considered-and-didnt-do"
},
{
"depth": 2,
"text": "What To Do When I Come Back To This",
"id": "what-to-do-when-i-come-back-to-this"
}
],
"format": "md",
"componentKey": null,
"contentHash": null,
"authors": null,
"authorship": "ai-assisted",
"authorshipNote": null,
"tags": [
"next-js",
"metadata",
"tech-debt",
"client-components",
"seo"
],
"projectId": "b3d6e577-4481-4477-9b9f-cea025e63e92",
"sectionId": null,
"publishedAt": "2026-05-07T21:38:34.807Z",
"revisedAt": null,
"sortOrder": 0,
"source": "db",
"file": null,
"missingSince": null,
"createdAt": "2026-11-18T21:24:28.091Z",
"updatedAt": "2026-11-18T21:24:28.091Z",
"link": null,
"project": {
"slug": "jaygriff-v2",
"title": "jaygriff-v2"
},
"section": null,
"assets": []
}