19 lines
894 B
TypeScript
19 lines
894 B
TypeScript
/**
|
|||
|
|
* The one place the site's absolute origin is written down.
|
||
|
|
*
|
||
|
|
* The apex domain 301s to www at Cloudflare, so www is the host that actually
|
||
|
|
* serves a 200. Canonicals, og:url, sitemap <loc> entries and the robots.txt
|
||
|
|
* Sitemap: line must all agree with it — a canonical pointing at a redirect
|
||
|
|
* makes Google resolve the hop before it can consolidate the signal.
|
||
|
|
*
|
||
|
|
* backend/app.py holds the same value as BASE_URL for the sitemap. The two are
|
||
|
|
* asserted against each other by the e2e journeys rather than shared at build
|
||
|
|
* time, because the backend and frontend ship as separate images.
|
||
|
|
*/
|
||
|
|
export const SITE_URL = 'https://www.schoolcompare.co.uk';
|
||
|
|
|
||
|
|
/** Absolute URL for a site-relative path. Tolerates a missing leading slash. */
|
||
|
|
export function absoluteUrl(path: string): string {
|
||
|
|
const rooted = path.startsWith('/') ? path : `/${path}`;
|
||
|
|
return `${SITE_URL}${rooted}`;
|
||
|
|
}
|