--- import { SIDEBAR } from '../../config.ts'; import { getLanguageFromURL, removeLeadingSlash, removeTrailingSlash, } from '../../util.ts'; const { currentPage } = Astro.props; // Get the slug w/o a leading or trailing slash const currentPageMatch = removeLeadingSlash(removeTrailingSlash(currentPage)); const langCode = getLanguageFromURL(currentPage); // SIDEBAR is a flat array. Group it by sections to properly render. const sidebarSections = SIDEBAR[langCode].reduce((col, item) => { if (item.header) { col.push({ ...item, children: [] }); } else { col[col.length - 1].children.push(item); } return col; }, []); ---