Skip to content

feat: Product name in page title#217

Closed
ribiza wants to merge 1 commit into
v1rc1from
sitetitle
Closed

feat: Product name in page title#217
ribiza wants to merge 1 commit into
v1rc1from
sitetitle

Conversation

@ribiza

@ribiza ribiza commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Page titles are currently in the format

Getting Started | Source Developer Home

which is bad for indexing, as there's no mention of the product the page is referring to. There can be 4 Getting started all 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:

Getting Started | DefraDB | Source Docs

while also changing the site name from Source Developer Home to Source Docs.

(Option introduced in Docusaurus 3.8.0 via facebook/docusaurus#11090)

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR updates the Docusaurus site configuration with new title and tagline strings, then adds a new React component (ThemeProviderTitleFormatter) that applies custom title formatting based on plugin identifiers, mapping specific plugins to hardcoded project names.

Changes

Site Metadata and Title Formatting

Layer / File(s) Summary
Configuration Update
docusaurus.config.js
Site title changes from "Source Developer Portal" to "Source Docs"; tagline changes from "The Home of Source Developers" to "The Source Stack Documentation".
Title Formatter Component
src/theme/ThemeProvider/TitleFormatter/index.tsx
New component exports ThemeProviderTitleFormatter, which wraps children with TitleFormatterProvider. The custom formatter inspects params.plugin.id and maps specific plugin IDs (defradb, sourcehub, orbis, lensvm) to project names, composing a formatted title string; other plugin IDs delegate to the default formatter.

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@ribiza ribiza requested a review from jsimnz May 4, 2026 05:18
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 4, 2026

Copy link
Copy Markdown

Deploying docs-source-network with  Cloudflare Pages  Cloudflare Pages

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

View logs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/theme/ThemeProvider/TitleFormatter/index.tsx (1)

7-24: ⚡ Quick win

Replace the if-else chain with a lookup record.

The cascading if/else if on plugin.id is tightly coupled to the plugin list in docusaurus.config.js. Adding a new plugin requires editing both files, and the coupling is easy to miss. A Record<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

📥 Commits

Reviewing files that changed from the base of the PR and between 5c412f3 and ae9d71e.

📒 Files selected for processing (2)
  • docusaurus.config.js
  • src/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 the reverseSidebarChangelog() function in docusaurus.config.js
The site uses dark mode by default with respectPrefersColorScheme: false
GitHub edit links should be configured to point to the master branch
Algolia search is configured with app ID N3M9YBYYQY

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 siteTitle output) and no coding guidelines are violated.

@jsimnz jsimnz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ribiza ribiza changed the base branch from master to v1rc1 June 29, 2026 13:30
@ribiza

ribiza commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Merged in #208, so closing this.

@ribiza ribiza closed this Jun 29, 2026
@ribiza ribiza deleted the sitetitle branch June 29, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants