Skip to content

fix(metadata): Remove Duplicate Site Names from Page Titles#30

Merged
TKanX merged 4 commits intomainfrom
bugfix/29-page-titles-display-duplicate-site-names
Feb 19, 2026
Merged

fix(metadata): Remove Duplicate Site Names from Page Titles#30
TKanX merged 4 commits intomainfrom
bugfix/29-page-titles-display-duplicate-site-names

Conversation

@TKanX
Copy link
Copy Markdown
Member

@TKanX TKanX commented Feb 19, 2026

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):

    • Removed manual site name concatenation in favor of returning clean title strings.
    • Updated to construct OpenGraph and Twitter metadata objects conditionally, avoiding redundant title suffixes.
    • Simplified the function signature to accept destructured options directly.
  • Centralized Title Template (src/app/layout.tsx):

    • Moved the title template configuration (%s | Caltech MSC) to the root layout metadata export.
    • Defined a default title (Caltech MSC) for the root page.
  • Updated Page Metadata:

    • Removed manual title formatting from Admin pages (admins, collaborators, members, photos, publications, research, sync).
    • Updated public pages (calendar, photos) to use pageDescriptions constants for consistency.
    • Ensured specific entity pages (Member Detail, Publication Detail) pass raw titles (e.g., Member Name) to leverage the new template system.
  • Cleaned Up Configuration:

    • Removed seoDefaults from src/config/site.ts as its logic is now handled more robustly within metadata.ts and layout.tsx.

@TKanX TKanX self-assigned this Feb 19, 2026
Copilot AI review requested due to automatic review settings February 19, 2026 02:04
@TKanX TKanX added the bug 🐛 Something isn't working label Feb 19, 2026
@TKanX TKanX linked an issue Feb 19, 2026 that may be closed by this pull request
3 tasks
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 createPageMetadata to 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.template feature
  • Removed seoDefaults export 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.

Comment thread src/lib/metadata.ts Outdated
Comment thread src/lib/metadata.ts Outdated
Comment thread src/lib/metadata.ts
Comment thread src/lib/metadata.ts
Comment thread src/app/(public)/events/photos/page.tsx
Comment thread src/app/(public)/events/calendar/page.tsx
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/app/admin/(authenticated)/layout.tsx
@TKanX TKanX merged commit 343d0a7 into main Feb 19, 2026
8 checks passed
@TKanX TKanX deleted the bugfix/29-page-titles-display-duplicate-site-names branch February 19, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page Titles Display Duplicate Site Names

2 participants