--- import { getLanguageFromURL } from '../../languages'; import { SIDEBAR } from '../../config'; 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, 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 { col[col.length - 1].children.push(item); } return col; }, []); ---