aboutsummaryrefslogtreecommitdiff
path: root/examples/docs/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'examples/docs/src/components')
-rw-r--r--examples/docs/src/components/LeftSidebar/LeftSidebar.astro9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/docs/src/components/LeftSidebar/LeftSidebar.astro b/examples/docs/src/components/LeftSidebar/LeftSidebar.astro
index dd7b34e0f..99a03213d 100644
--- a/examples/docs/src/components/LeftSidebar/LeftSidebar.astro
+++ b/examples/docs/src/components/LeftSidebar/LeftSidebar.astro
@@ -5,7 +5,14 @@ const { currentPage } = Astro.props;
const currentPageMatch = currentPage.slice(1);
const langCode = getLanguageFromURL(currentPage);
// SIDEBAR is a flat array. Group it by sections to properly render.
-const sidebarSections = SIDEBAR[langCode].reduce((col, item) => {
+const sidebarSections = SIDEBAR[langCode].reduce((col, item, i) => {
+ // If the first item is not a section header, create a new container section.
+ if (i === 0) {
+ if (!item.header) {
+ const pesudoSection = { text: "" };
+ col.push({ ...pesudoSection, children: [] });
+ }
+ }
if (item.header) {
col.push({ ...item, children: [] });
} else {