Skip to content

feat(seo): add useSeo hook for per-route title and meta description#468

Open
samjay8 wants to merge 1 commit into
CredenceOrg:mainfrom
samjay8:feat/seo-per-route-metadata
Open

feat(seo): add useSeo hook for per-route title and meta description#468
samjay8 wants to merge 1 commit into
CredenceOrg:mainfrom
samjay8:feat/seo-per-route-metadata

Conversation

@samjay8

@samjay8 samjay8 commented Jun 29, 2026

Copy link
Copy Markdown

Closes #398

Summary

Introduces src/hooks/useSeo.ts -- a drop-in superset of useDocumentTitle that also manages <meta name="description"> on a per-route basis. Every route-level page component can now own its SEO metadata inline rather than relying on the static fallback in index.html.

Changes

  • src/hooks/useSeo.ts -- new useSeo({ title, description, brandSuffix?, restoreOnUnmount? }) hook that sets document.title (via formatDocumentTitle) and creates/updates/restores <meta name="description"> with full lifecycle management
  • src/hooks/useSeo.test.ts -- comprehensive RTL test suite covering title management (brand suffix, double-suffix guard, restore on unmount) and meta description management (create, update existing, restore, remove on unmount)
  • Pages migrated: Bond, Home, Dashboard, TrustScore, Settings -- all now call useSeo with a descriptive per-route description
  • docs/HOOKS.md -- added useSeo entry under hooks catalog
  • docs/COMPONENTS.md -- added cross-reference note directing consumers to useSeo for per-route SEO

Backwards compatibility

useDocumentTitle is unchanged and still exported. useSeo is purely additive.

Test plan

  • npm run lint passes
  • npm run build passes
  • npm run test passes

Introduces src/hooks/useSeo.ts — a drop-in superset of useDocumentTitle that
additionally manages <meta name="description"> on a per-route basis. Pages now
own their SEO metadata inline rather than relying on the static index.html
fallback, giving search engines and social-card scrapers accurate per-route context.

- Create useSeo hook with title + description + restoreOnUnmount lifecycle
- Add full RTL test suite in src/hooks/useSeo.test.ts
- Migrate Bond, Home, Dashboard, TrustScore, Settings pages to useSeo
- Document the hook in docs/HOOKS.md and cross-reference in docs/COMPONENTS.md

Closes CredenceOrg#398
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@samjay8 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Add per-route metadata for SEO

1 participant