also looking at this
fix: preserve deployment paths in local search results
#91
5 files
+81
-23
| @@ -2,6 +2,7 @@ import type { BunPressConfig, LocalSearchOptions, SearchConfig } from './types' | ||
| 2 | 2 | import { Glob, YAML } from 'bun' |
| 3 | 3 | import { join } from 'node:path' |
| 4 | 4 | import { localizeUrl, resolveI18nConfig } from './i18n' |
| 5 | import { getConfiguredBasePath } from './site-url' | |
| 5 | 6 | import { createFenceTracker, stripFencedCode } from './markdown-fences' |
| 6 | 7 | import { unwrapMessageFences } from './message-previews' |
| 7 | 8 | import { generateSlug, markdownHeadingText, reserveUniqueSlug } from './toc' |
| @@ -473,5 +474,12 @@ export async function buildSearchIndex(docsDir: string, config?: BunPressConfig) | ||
| 473 | 474 | } |
| 474 | 475 | } |
| 475 | 476 | |
| 477 | // Apply the deployment prefix after locale fallback has compared page keys. | |
| 478 | // Every record is still docs-relative here, including a real `docs/` directory. | |
| 479 | const basePath = config ? getConfiguredBasePath(config) : '' | |
| 480 | if (basePath) { | |
| 481 | for (const record of records) record.url = `${basePath}${record.url}` | |
| 482 | } | |
| 483 | ||
| 476 | 484 | return applyStoreFields(records, options) |
| 477 | 485 | } |