Conversation
📝 WalkthroughWalkthroughThe PR updates the Docusaurus site configuration with new title and tagline strings, then adds a new React component ( ChangesSite Metadata and Title Formatting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Deploying docs-source-network with
|
| Latest commit: |
ae9d71e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://594f8b20.docs-source-network.pages.dev |
| Branch Preview URL: | https://sitetitle.docs-source-network.pages.dev |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/theme/ThemeProvider/TitleFormatter/index.tsx (1)
7-24: ⚡ Quick winReplace the if-else chain with a lookup record.
The cascading
if/else ifonplugin.idis tightly coupled to the plugin list indocusaurus.config.js. Adding a new plugin requires editing both files, and the coupling is easy to miss. ARecord<string, string>lookup centralises the mapping, removes the repetition, and also sidesteps the loose-equality operators (==/!=) throughout.♻️ Proposed refactor
-const formatter: FormatterProp = (params) => { - let project = undefined - if (params.plugin.id == 'defradb') { - project = 'DefraDB'; - } else if (params.plugin.id == 'sourcehub') { - project = 'SourceHub'; - } else if (params.plugin.id == 'orbis') { - project = 'Orbis'; - } else if (params.plugin.id == 'lensvm') { - project = 'LensVM'; - } - - if (project != undefined) { - return `${params.title} ${params.titleDelimiter} ${project} ${params.titleDelimiter} ${params.siteTitle}`; - } else { - return params.defaultFormatter(params); - } -}; +const PLUGIN_PROJECT_NAMES: Record<string, string> = { + defradb: 'DefraDB', + sourcehub: 'SourceHub', + orbis: 'Orbis', + lensvm: 'LensVM', +}; + +const formatter: FormatterProp = (params) => { + const project = PLUGIN_PROJECT_NAMES[params.plugin.id]; + if (project !== undefined) { + return `${params.title} ${params.titleDelimiter} ${project} ${params.titleDelimiter} ${params.siteTitle}`; + } + return params.defaultFormatter(params); +};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/theme/ThemeProvider/TitleFormatter/index.tsx` around lines 7 - 24, Replace the cascading if/else chain in the formatter function with a Record<string,string> lookup: create a mapping object (e.g. projectNames) keyed by params.plugin.id to project display names, use projectNames[params.plugin.id] to get the project, and use strict equality checks (check for undefined via !==) to decide whether to return the composed title string or fallback to params.defaultFormatter(params); update references in formatter to use params.title, params.titleDelimiter and params.siteTitle as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/theme/ThemeProvider/TitleFormatter/index.tsx`:
- Around line 7-24: Replace the cascading if/else chain in the formatter
function with a Record<string,string> lookup: create a mapping object (e.g.
projectNames) keyed by params.plugin.id to project display names, use
projectNames[params.plugin.id] to get the project, and use strict equality
checks (check for undefined via !==) to decide whether to return the composed
title string or fallback to params.defaultFormatter(params); update references
in formatter to use params.title, params.titleDelimiter and params.siteTitle as
before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f9e8c5c-5f51-444e-9a29-bf7ccf0aa6b0
📒 Files selected for processing (2)
docusaurus.config.jssrc/theme/ThemeProvider/TitleFormatter/index.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (2)
src/{theme,css,code-theme}/**/*.{js,jsx,ts,tsx,scss,css}
📄 CodeRabbit inference engine (CLAUDE.md)
Custom theme components use Docusaurus swizzling with custom footer components, color mode toggle, SCSS styling in
/src/css/custom.scss, and custom code theme in/src/code-theme/code-theme.js
Files:
src/theme/ThemeProvider/TitleFormatter/index.tsx
docusaurus.config.js
📄 CodeRabbit inference engine (CLAUDE.md)
docusaurus.config.js: Changelog and release notes sidebar items should be automatically reversed (newest first) via thereverseSidebarChangelog()function indocusaurus.config.js
The site uses dark mode by default withrespectPrefersColorScheme: false
GitHub edit links should be configured to point to the master branch
Algolia search is configured with app IDN3M9YBYYQY
Files:
docusaurus.config.js
🔇 Additional comments (1)
docusaurus.config.js (1)
8-9: LGTM!Title and tagline updates align with the PR objective ("Source Docs" matches the formatter's
siteTitleoutput) and no coding guidelines are violated.
|
Merged in #208, so closing this. |
Page titles are currently in the format
which is bad for indexing, as there's no mention of the product the page is referring to. There can be 4
Getting startedall with the same page title. We can't fix it by tweaking the site title as we deploy different products under one project.This work extracts the relevant theme component and changes the pages title format to:
while also changing the site name from
Source Developer HometoSource Docs.(Option introduced in Docusaurus 3.8.0 via facebook/docusaurus#11090)