Skip to content

Fix docs canonical URLs and add missing redirects - #463

Draft
codingfrog27 wants to merge 2 commits into
mainfrom
fix/docs-canonical-and-redirects
Draft

Fix docs canonical URLs and add missing redirects#463
codingfrog27 wants to merge 2 commits into
mainfrom
fix/docs-canonical-and-redirects

Conversation

@codingfrog27

Copy link
Copy Markdown
Contributor

Draft for now to test out preview links. But expext to merge this week

The astro-theme sets build.format: "file", so Astro.url.pathname carries a
.html suffix during the build while Cloudflare serves the extensionless form
as the 200. BaseHead.astro built the canonical and og:url from the raw
pathname, so every docs page declared a canonical pointing at a URL that
redirects back to itself. Nothing else on the site publishes those addresses,
which makes the canonical tag the only reason Google has them: 24 URLs in
Search Console's "Page with redirect" bucket originate here.

normalisedPath already existed in the file and already stripped the suffix,
added in #422 for the blog-override lookup. The fallback branch now uses it.

Also:
- _redirects: 301s for eight renamed docs paths confirmed 404ing in the
  Search Console export, plus a real 301 for the /docs meta-refresh stub.
  Specific rules are ordered above the .html wildcards so renamed paths
  resolve in one hop.
- sitemap.xml.ts: stop submitting /docs/, which was listed at priority 0.8,
  the highest in the file, despite being a meta-refresh stub Google will
  never index.

No URL that currently returns 200 changes behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant