fix(metadata): Remove Duplicate Site Names from Page Titles#30
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses duplicate site names in page titles (e.g., "Research | Caltech MSC | Caltech MSC") by refactoring the metadata generation system. The approach delegates title template formatting to Next.js layouts using the title.template feature, eliminating manual concatenation that caused duplicates.
Changes:
- Refactored
createPageMetadatato return clean titles without manual site name concatenation, delegating template formatting to layouts - Centralized title templates in root and admin layouts using Next.js
title.templatefeature - Removed
seoDefaultsexport from site configuration, moving its logic to metadata functions and layouts
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/metadata.ts | Refactored to remove manual title concatenation and seoDefaults import; simplified to use conditional metadata spreading |
| src/config/site.ts | Removed seoDefaults export as logic moved to metadata.ts and layouts |
| src/app/admin/(authenticated)/layout.tsx | Added title template for admin pages: %s | Admin | ${siteConfig.name} |
| src/app/admin/(authenticated)/page.tsx | Removed " |
| src/app/admin/(authenticated)/sync/page.tsx | Removed " |
| src/app/admin/(authenticated)/research/page.tsx | Removed " |
| src/app/admin/(authenticated)/publications/page.tsx | Removed " |
| src/app/admin/(authenticated)/photos/page.tsx | Removed " |
| src/app/admin/(authenticated)/members/page.tsx | Removed " |
| src/app/admin/(authenticated)/members/categories/page.tsx | Removed " |
| src/app/admin/(authenticated)/collaborators/page.tsx | Removed " |
| src/app/admin/(authenticated)/admins/page.tsx | Removed " |
| src/app/(public)/events/photos/page.tsx | Updated to use centralized pageDescriptions.photos constant |
| src/app/(public)/events/calendar/page.tsx | Updated to use centralized pageDescriptions.calendar constant |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lusion and defaults
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary:
Corrected an issue where page titles were displaying duplicate site names (e.g., "Research | Caltech MSC | Caltech MSC") by refactoring the metadata generation utility. This change ensures clean, SEO-friendly titles by delegating the title template formatting to the root layout, rather than manually appending the site name in every page's metadata function.
Changes:
Refactored
createPageMetadata(src/lib/metadata.ts):Centralized Title Template (
src/app/layout.tsx):%s | Caltech MSC) to the root layout metadata export.Caltech MSC) for the root page.Updated Page Metadata:
admins,collaborators,members,photos,publications,research,sync).calendar,photos) to usepageDescriptionsconstants for consistency.Cleaned Up Configuration:
seoDefaultsfromsrc/config/site.tsas its logic is now handled more robustly withinmetadata.tsandlayout.tsx.