also looking at this
Adopt the hq-apps app conventions
#76
31 files
+1656
-395
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | import { db } from '@stacksjs/database' |
| 2 | import site from '~/site.config' | |
| 2 | 3 | |
| 3 | 4 | /** |
| 4 | 5 | * Shared sitemap + robots builders. |
| @@ -29,11 +30,23 @@ const STATIC_PATHS: Array<{ path: string, priority: number, changefreq: string } | ||
| 29 | 30 | { path: '/register', priority: 0.5, changefreq: 'yearly' }, |
| 30 | 31 | ] |
| 31 | 32 | |
| 32 | /** Normalize a base URL: trim trailing slashes so `${base}${path}` is clean. */ | |
| 33 | /** | |
| 34 | * Normalize a base URL: trim trailing slashes so `${base}${path}` is clean. | |
| 35 | * | |
| 36 | * The fallback is deliberately the LOCAL dev host, not the production | |
| 37 | * canonical: a build with APP_URL unset must produce an obviously-local | |
| 38 | * artifact that the conformance gate rejects ("APP_URL unset — artifact | |
| 39 | * carries N loopback URLs"), rather than a plausible-looking one that | |
| 40 | * silently claims to be production. `site.url` is the canonical host and is | |
| 41 | * what you get once APP_URL is set; see DEPLOY.md. | |
| 42 | */ | |
| 33 | 43 | export function normalizeBase(raw: string | undefined): string { |
| 34 | 44 | return (raw || 'http://localhost:4000').replace(/\/+$/, '') |
| 35 | 45 | } |
| 36 | 46 | |
| 47 | /** The production canonical origin, from site.config.ts. */ | |
| 48 | export const CANONICAL_BASE: string = site.url.replace(/\/+$/, '') | |
| 49 | ||
| 37 | 50 | /** |
| 38 | 51 | * Build the full sitemap XML from current DB content. Every judge gets a |
| 39 | 52 | * /judges/:id/profile entry, every courthouse /court-houses/:id/profile, |