Skip to content

Commit 171c374

Browse files
committed
fix(web): correct capitalisation of FAQ topic titles
Fix brand casing (AI DevKit, Agent OS, BMAD, SuperClaude, AGENTS.md, CLAUDE.md, opencode) and lowercase minor words mid-title to match the docs title style. Slugs and URLs are unchanged.
1 parent 52eec02 commit 171c374

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

‎web/lib/seo/keywords.ts‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,20 @@ const titleCaseOverrides: Record<string, string> = {
2424
api: "API",
2525
vs: "vs",
2626
md: "MD",
27+
devkit: "DevKit",
28+
os: "OS",
29+
bmad: "BMAD",
30+
superclaude: "SuperClaude",
31+
opencode: "opencode",
32+
"agents.md": "AGENTS.md",
33+
"claude.md": "CLAUDE.md",
2734
};
2835

36+
// Lowercase mid-title, matching the docs' title style ("Development with AI DevKit").
37+
const minorWords = new Set([
38+
"a", "an", "and", "as", "at", "but", "by", "for", "in", "of", "on", "or", "the", "to", "with",
39+
]);
40+
2941
const rawSeoKeywords = [
3042
// Brand and category-defining
3143
"AI agent control plane",
@@ -233,16 +245,28 @@ function slugifyKeyword(keyword: string): string {
233245
.replace(/(^-|-$)/g, "");
234246
}
235247

248+
function capitalizeWord(word: string): string {
249+
const lower = word.toLowerCase();
250+
if (titleCaseOverrides[lower]) {
251+
return titleCaseOverrides[lower];
252+
}
253+
// Hyphenated words capitalize each part: "Spec-Driven".
254+
return lower
255+
.split("-")
256+
.map((part) => titleCaseOverrides[part] ?? `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
257+
.join("-");
258+
}
259+
236260
function normalizeTitleCase(keyword: string): string {
237261
return keyword
238262
.trim()
239263
.split(/\s+/)
240-
.map((word) => {
264+
.map((word, index) => {
241265
const lower = word.toLowerCase();
242-
if (titleCaseOverrides[lower]) {
243-
return titleCaseOverrides[lower];
266+
if (index > 0 && minorWords.has(lower)) {
267+
return lower;
244268
}
245-
return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;
269+
return capitalizeWord(word);
246270
})
247271
.join(" ");
248272
}

0 commit comments

Comments
 (0)