feat(docs): add dab config and docs path#33
Conversation
Greptile SummaryThis PR adds a
Confidence Score: 4/5The change is mechanical and self-consistent — all internal links and static asset paths have been updated to match the new The path updates across components and the src/bach/utils.ts (BASE_PREFIX sync), dab.config.ts (import ordering) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Request to botpress.com/docs/*"] --> B["Astro static site\nsite: 'https://botpress.com'\nbase: '/docs'"]
B --> C{Path type}
C -->|"Internal nav link"| D["Hardcoded in\nHomePage.astro / header.tsx\n/ mobile-sidebar.tsx"]
C -->|"Sidebar link"| E["withBase() in utils.ts\nBASE_PREFIX = '/docs'"]
C -->|"Static asset"| F["Hardcoded /docs/ prefix\nin site-config.ts /\nBaseLayout.astro /\nSearchButton.tsx"]
E --> G["Rendered href: /docs/path"]
D --> G
F --> H["Served from public/ under /docs/ base"]
G --> I["User navigates correctly within /docs/*"]
H --> I
Reviews (1): Last reviewed commit: "feat(docs): add dab config and docs path" | Re-trigger Greptile |
| /** URL prefix matching Astro's `base` config — must stay in sync with astro.config.mjs. */ | ||
| export const BASE_PREFIX = '/docs' |
There was a problem hiding this comment.
Dual source of truth for the base path
BASE_PREFIX is hardcoded to '/docs' with a manual sync requirement against astro.config.mjs. Astro/Vite exposes import.meta.env.BASE_URL at build time (e.g. /docs/), which always reflects whatever base is in astro.config.mjs — eliminating the risk of the two drifting apart. Consider deriving BASE_PREFIX from it instead: const BASE_PREFIX = import.meta.env.BASE_URL.replace(/\/$/, '').
…ls function to provide the hard-coded docs path
| } | ||
|
|
||
| /** URL prefix derived from Astro's `base` config (e.g. `/docs`). Empty when base is `/`. */ | ||
| export const BASE_PREFIX = import.meta.env.BASE_URL.replace(/\/$/, '') |
There was a problem hiding this comment.
todo (non-blocking): bach shouldn't read from the environment. BASE_URL is set by astro, we should pass the BASE_URL through some input to bach. We use the bach Site class to pass input from astro to bach. We should move these utils onto the site and pass in the BASE_URL to the Site constructor.
Add dab config to
docs-v2.foundation.botpress.cloud&docs-v2.foundation.botpress.cloud.dev. Update base path to usedocsto matchbotpress.com/docs