Skip to content

feat: update document titles on route changes - #469

Open
23241a6749 wants to merge 1 commit into
AOSSIE-Org:mainfrom
23241a6749:feat/route-document-titles
Open

23241a6749 wants to merge 1 commit into
AOSSIE-Org:mainfrom
23241a6749:feat/route-document-titles

Conversation

@23241a6749

@23241a6749 23241a6749 commented Nov 19, 2026 •

Copy link
Copy Markdown

Addressed Issues:

Fixes #462

Navigating between pages currently keeps the static index.html title. This updates the browser title to match the active route, including the username on contributor profiles and the 404 fallback.

A small DocumentTitle component uses React Router's existing matching rules and is mounted once in App. It handles complete paths, decoded usernames and redirects without adding dependencies.

Screenshots/Recordings:

Local browser verification on Windows:

Action Observed browser title
Open Home OrgExplorer — Home
Navigate to Settings Settings — OrgExplorer
Navigate to Support Us Support Us — OrgExplorer
Back / Forward Settings / Support Us titles restored
Open Overview without analysis OrgExplorer — Home after redirect
Open /settings/extra 404 Not Found — OrgExplorer

The screenshot below shows the resulting 404 page; the titles above were checked separately through the browser title API.

Local 404 page at /settings/extra; browser title verified separately

Additional Notes:

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation — no setup or usage instructions change; route maintenance is noted above
  • My changes generate no new warnings or errors — existing suite failures and build diagnostics are listed above
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

AI assistance

OpenAI GPT-6 in Codex assisted with implementation, regression tests, code review and local validation.

Summary by CodeRabbit

  • New Features
    • Browser tab titles now update to match the current page, including contributor profiles and unmatched routes.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The application now sets document.title according to the active route. Contributor profile titles include the username, and unmatched paths use a 404 title. Tests cover route titles and title changes during navigation.

Changes

Route-Based Document Titles

Layer / File(s) Summary
Route title selection and update
src/components/DocumentTitle.jsx
A new component matches the current path to a static or username-based title, uses a 404 title for unmatched paths, and updates document.title.
App integration and route title tests
src/App.jsx, src/App.titles.test.jsx
AppContent renders DocumentTitle before the routes. Tests check titles across routes, query strings, fragments, case and encoding variants, profile history navigation, unmatched paths, and an analysis-guard redirect.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Router
  participant AppContent
  participant DocumentTitle
  participant Browser
  AppContent->>DocumentTitle: renders title component
  Router->>DocumentTitle: provides current pathname
  DocumentTitle->>Browser: updates document.title
Loading

Suggested labels: Typescript Lang

Merge Risk: Minimal · up to 4cfcc

This change sets the browser tab title for each route, including contributor usernames and a 404 fallback. It is low risk and easy to reverse, and no merge-blocking issues were found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat: update document titles on route changes" matches the main change. The PR adds a DocumentTitle component that sets document.title per route, mounts it once in App, and adds route tests…
Linked Issues check Passed Issue #462 requires a route-specific document.title for each listed route. At the reviewed head, src/components/DocumentTitle.jsx defines a title entry for each route: '/' (Home), '/overview', '/repos…
Out of Scope Changes check Passed The whole-PR changes (merge base b396d1b to head 4cfccbe) touch three areas: src/components/DocumentTitle.jsx (new title logic), src/App.jsx (+2 lines: import and mount of DocumentTitle), and src/App.…
Full details: Title check

Explanation

The title "feat: update document titles on route changes" matches the main change. The PR adds a DocumentTitle component that sets document.title per route, mounts it once in App, and adds route tests. The title is specific and concise, and it names the primary change from the developer's perspective.

Full details: Linked Issues check

Explanation

Issue #462 requires a route-specific document.title for each listed route. At the reviewed head, src/components/DocumentTitle.jsx defines a title entry for each route: '/' (Home), '/overview', '/repositories', '/contributors', '/contributors/:username' (username from decoded router params, formatted as '{username} — Contributor Profile — OrgExplorer'), '/network' ('Network Graph — OrgExplorer'), '/analytics', '/governance' ('Governance Audit — OrgExplorer'), '/settings', '/support-us', and '*' ('404 Not Found — OrgExplorer'). The component reads the location with useLocation, resolves the entry with matchRoutes, and sets document.title in a useEffect keyed on the title. src/App.jsx mounts <DocumentTitle /> once inside AppContent, so it runs for all routes, including redirects, because it follows the current location. The added tests in src/App.titles.test.jsx cover the listed routes, profile changes, query/hash/trailing-slash variants, history navigation, and unknown nested paths. The author reports these 18 cases pass. I did not run the tests. The implementation meets the coding requirements of #462. The issue permits either a shared hook or per-page effects, so the chosen approach is acceptable.

Full details: Out of Scope Changes check

Explanation

The whole-PR changes (merge base b396d1b to head 4cfccbe) touch three areas: src/components/DocumentTitle.jsx (new title logic), src/App.jsx (+2 lines: import and mount of DocumentTitle), and src/App.titles.test.jsx (new tests for the title behavior). Each change supports the title objective. The PR does not alter data fetching, PAT handling, or caching, as the description states, and the diff summary shows no unrelated edits. No out-of-scope change was found.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit hops past tabs at night,
Each page now wears its title right.
A profile name appears in view,
A 404 title joins the queue.
Back and forward change the scene,
The rabbit nibbles something green.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b396d1b and 4cfccbe.

Files selected for processing: 3

  • src/App.jsx
  • src/App.titles.test.jsx
  • src/components/DocumentTitle.jsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions github-actions Bot added enhancement New feature or request frontend Frontend changes javascript JavaScript/TypeScript changes tests Test changes size/M 51-200 lines changed first-time-contributor First time contributor and removed size/M 51-200 lines changed labels Nov 19, 2026

This branch has not been deployed

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

Labels

enhancement New feature or request first-time-contributor First time contributor frontend Frontend changes javascript JavaScript/TypeScript changes size/M 51-200 lines changed tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Set dynamic document.title based on active page route

1 participant