(dir: string, section: string)
| 169 | ) |
| 170 | |
| 171 | const resolveFolder = (dir: string, section: string): NavFolder => { |
| 172 | const meta = readMeta(dir) ?? {} |
| 173 | const entries = meta.pages ?? defaultEntries(dir) |
| 174 | const indexPath = join(dir, "index.mdx") |
| 175 | let index: Page | undefined |
| 176 | if (!entries.includes("index") && existsSync(indexPath)) { |
| 177 | index = loadPage(indexPath, section) |
| 178 | listPage(index) |
| 179 | } |
| 180 | const folder: NavFolder = { |
| 181 | kind: "folder", |
| 182 | title: meta.title ?? index?.frontmatter.title ?? dir.split(sep).at(-1)!, |
| 183 | defaultOpen: meta.defaultOpen ?? false, |
| 184 | index, |
| 185 | items: resolveEntries( |
| 186 | dir, |
| 187 | entries.filter(entry => entry !== "index" || !index), |
| 188 | section |
| 189 | ) |
| 190 | } |
| 191 | const icon = meta.icon ?? index?.frontmatter.icon |
| 192 | if (icon) folder.icon = icon |
| 193 | return folder |
| 194 | } |
| 195 | |
| 196 | const rootMeta = readMeta(contentDir) ?? {} |
| 197 | const sectionIds = [ |
no test coverage detected