()
| 36 | * Get the base path for the site |
| 37 | */ |
| 38 | export function getBasePath(): string { |
| 39 | // In Astro, import.meta.env.BASE_URL is available at build time |
| 40 | // At runtime, we use a data attribute on the body |
| 41 | if (typeof document !== "undefined") { |
| 42 | return document.body.dataset.basePath || "/"; |
| 43 | } |
| 44 | return "/"; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Fetch JSON data from the data directory |