The apex 301s to www at Cloudflare, but metadataBase, the school-page canonical, robots.txt's Sitemap: line and the sitemap's own <loc> entries all named the apex. Every one of those pointed Google at a redirect. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015mWQnpye9F299NVRCCSRvj
20 lines
894 B
TypeScript
20 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}`;
|
|
}
|