From 72b158effcbbaae591729529a2232b1f82bb0612 Mon Sep 17 00:00:00 2001 From: Adam Gohs Date: Fri, 16 Oct 2026 09:50:38 -0400 Subject: [PATCH] Let a registry entry set its document's sidebar and breadcrumb name The sidebar generator named every document by title-casing its folder, so an abbreviated folder such as cle-freezing-screening showed up as "Cle Freezing Screening" in the sidebar and breadcrumbs. An optional sidebar_label on the document's docConfig entry now overrides that. --- scripts/generateSidebars.js | 4 ++-- src/docConfig.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/generateSidebars.js b/scripts/generateSidebars.js index 8e8999b11..089f3c9af 100644 --- a/scripts/generateSidebars.js +++ b/scripts/generateSidebars.js @@ -14,7 +14,7 @@ const fs = require('fs'); const path = require('path'); -const { shouldExcludeFromBuild } = require('../src/docConfig'); +const { docs: registry, shouldExcludeFromBuild } = require('../src/docConfig'); const DOCS_DIR = path.join(__dirname, '..', 'docs'); const SIDEBAR_PATH = path.join(__dirname, '..', 'sidebars.js'); @@ -576,7 +576,7 @@ function generateSidebars() { const versionFormatted = version.replace(/\./g, '_'); const sidebarKey = `${groupCamel}${folderCamel}_${versionFormatted}`; - const documentName = titleCase(folderName); + const documentName = registry.find((d) => d.doc_location === docPath)?.sidebar_label || titleCase(folderName); // Only create if not already present if (!sidebarContent[sidebarKey]) { diff --git a/src/docConfig.js b/src/docConfig.js index 94aa4cf81..3aa150ad4 100644 --- a/src/docConfig.js +++ b/src/docConfig.js @@ -26,6 +26,10 @@ * with watermark, fully searchable) or inactive+draft (unpublished, no * watermark visible because the doc isn't on the prod site). * + * Sidebar label (optional): `sidebar_label` sets the document's name in its sidebar + * and breadcrumbs. Without it, the name is the title-cased folder name, which is + * wrong for folders that abbreviate (e.g. "cle-freezing-screening" → "Cle …"). + * * Download-only entries (downloadUrl, no doc_location) are tiles that link * directly to a PDF — they have no associated MDX folder and are unaffected * by the active/draft build-inclusion logic.