Skip to content

fix: Duplicate site name in page title when no meta is set#443

Merged
ainsleyclark merged 2 commits intomainfrom
claude/fix-missing-meta-title-auYFs
Mar 18, 2026
Merged

fix: Duplicate site name in page title when no meta is set#443
ainsleyclark merged 2 commits intomainfrom
claude/fix-missing-meta-title-auYFs

Conversation

@ainsleyclark
Copy link
Contributor

Summary

Fixed an issue where the site name was being duplicated in the page title when no custom page meta title was provided.

Changes

  • Updated the title generation logic in PayloadSEO.svelte to check if the meta title equals the site name before appending it
  • When meta.title matches the site value (indicating no custom title was set), only the site name is displayed
  • When a custom title is provided, it's formatted as {title} | {siteName} as intended

Implementation Details

The fix uses a conditional expression to prevent the redundant pattern of "Site Name | Site Name" from appearing in the page title. This ensures cleaner, more semantic page titles while maintaining the desired format when custom meta titles are provided.

https://claude.ai/code/session_01P3Ms8vg5W6yoSqBfsVSWXv

claude added 2 commits March 18, 2026 14:06
When a page has no pageMeta or is missing a title, the fallback chain
resolves to the site name, causing titles like "Player2Clubs | Player2Clubs".

Now checks if meta.title equals the site name and renders the title alone
in that case, rather than duplicating it.

https://claude.ai/code/session_01P3Ms8vg5W6yoSqBfsVSWXv
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@claude
Copy link

claude bot commented Mar 18, 2026

Review summary

  • Overall score: 7/10
  • Critical issues: 0
  • Warnings: 2
  • Suggestions: 1
  • Recommendation: ⚠️ Approve with comments

Small focused fix addressing the duplicate site name issue. Sound logic but a subtle whitespace trimming edge case and missing tests.

Critical issues 🔴

None

Warnings 🟡

1. Whitespace trimming inconsistency

site trims but meta.title fallback does not. Add ?.trim() to the comparison.

2. No tests added

Add a unit test for the meta.title === site branch.

Suggestions 🟢

1. Extract a derived pageTitle variable

Makes the intent clearer:

const pageTitle = $derived(
  meta.title?.trim() === site ? site : `${meta.title} | ${siteName}`
);
<title>{pageTitle}</title>

@ainsleyclark ainsleyclark merged commit c69f2ce into main Mar 18, 2026
4 checks passed
@ainsleyclark ainsleyclark deleted the claude/fix-missing-meta-title-auYFs branch March 18, 2026 14:19
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.26%. Comparing base (7f6b060) to head (096c67c).
⚠️ Report is 528 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
+ Coverage   64.59%   70.26%   +5.67%     
==========================================
  Files         154      187      +33     
  Lines        6064     7439    +1375     
==========================================
+ Hits         3917     5227    +1310     
+ Misses       2064     2012      -52     
- Partials       83      200     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants