fix(seo): canonicalise on the www host, which is the one that serves 200
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
This commit is contained in:
1 parent
69f2201244
commit
0da8ab052b
7 files changed
+101
-6
No files matched your search
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 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}`;
|
||||
}
|
||||
Reference in new issue
Block a user