Skip to content

Commit c01ac87

Browse files
authored
Merge pull request #160 from USACE-RMC/fix/sidebar-label-from-registry
[Content] Let a registry entry set its document's sidebar and breadcrumb name
2 parents 0ba680e + 72b158e commit c01ac87

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎scripts/generateSidebars.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
const fs = require('fs');
1616
const path = require('path');
17-
const { shouldExcludeFromBuild } = require('../src/docConfig');
17+
const { docs: registry, shouldExcludeFromBuild } = require('../src/docConfig');
1818

1919
const DOCS_DIR = path.join(__dirname, '..', 'docs');
2020
const SIDEBAR_PATH = path.join(__dirname, '..', 'sidebars.js');
@@ -576,7 +576,7 @@ function generateSidebars() {
576576
const versionFormatted = version.replace(/\./g, '_');
577577
const sidebarKey = `${groupCamel}${folderCamel}_${versionFormatted}`;
578578

579-
const documentName = titleCase(folderName);
579+
const documentName = registry.find((d) => d.doc_location === docPath)?.sidebar_label || titleCase(folderName);
580580

581581
// Only create if not already present
582582
if (!sidebarContent[sidebarKey]) {

‎src/docConfig.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
* with watermark, fully searchable) or inactive+draft (unpublished, no
2727
* watermark visible because the doc isn't on the prod site).
2828
*
29+
* Sidebar label (optional): `sidebar_label` sets the document's name in its sidebar
30+
* and breadcrumbs. Without it, the name is the title-cased folder name, which is
31+
* wrong for folders that abbreviate (e.g. "cle-freezing-screening" → "Cle …").
32+
*
2933
* Download-only entries (downloadUrl, no doc_location) are tiles that link
3034
* directly to a PDF — they have no associated MDX folder and are unaffected
3135
* by the active/draft build-inclusion logic.

0 commit comments

Comments
 (0)