From 7013042ab9535d94ec19c3efe5324e3d4e317638 Mon Sep 17 00:00:00 2001 From: Josh Wooding <12938082+joshwooding@users.noreply.github.com> Date: Wed, 23 Aug 2023 14:09:39 +0100 Subject: [PATCH] Fix pages that are excluded from the sidebar having no sidebar --- .changeset/fast-bulldogs-grab.md | 5 +++++ packages/plugins/src/SidebarPlugin.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/fast-bulldogs-grab.md diff --git a/.changeset/fast-bulldogs-grab.md b/.changeset/fast-bulldogs-grab.md new file mode 100644 index 00000000..570e77db --- /dev/null +++ b/.changeset/fast-bulldogs-grab.md @@ -0,0 +1,5 @@ +--- +'@jpmorganchase/mosaic-plugins': patch +--- + +Fix pages that are excluded from the sidebar having no sidebar diff --git a/packages/plugins/src/SidebarPlugin.ts b/packages/plugins/src/SidebarPlugin.ts index 71a1f1be..1ee2ba29 100644 --- a/packages/plugins/src/SidebarPlugin.ts +++ b/packages/plugins/src/SidebarPlugin.ts @@ -245,9 +245,9 @@ const SidebarPlugin: PluginType { const sidebarFilePath = path.posix.join(String(rootDir), filename); - let pages = await createPageList(rootDir); - pages = pages.filter(page => removeExcludedPages(page)); - const groupMap = createGroupMap(pages); + const pages = await createPageList(rootDir); + const includedPages = pages.filter(page => removeExcludedPages(page)); + const groupMap = createGroupMap(includedPages); const sidebarData = linkGroupMap(groupMap, rootDir); if (sidebarData[0] === undefined) {