fix: Duplicate site name in page title when no meta is set#443
fix: Duplicate site name in page title when no meta is set#443ainsleyclark merged 2 commits intomainfrom
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review summary
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
2. No tests added Add a unit test for the 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> |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Summary
Fixed an issue where the site name was being duplicated in the page title when no custom page meta title was provided.
Changes
PayloadSEO.svelteto check if the meta title equals the site name before appending itmeta.titlematches thesitevalue (indicating no custom title was set), only the site name is displayed{title} | {siteName}as intendedImplementation 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