[codex] Fix Search Console stale URL redirects#148
Merged
Conversation
bc38b0e to
e6be930
Compare
Deploying qf-api-docs with
|
| Latest commit: |
40f1801
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7f164510.qf-api-docs.pages.dev |
| Branch Preview URL: | https://codex-search-console-url-rec.qf-api-docs.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses stale Google/Search Console URLs returning 404s by generating and validating a static set of Cloudflare Pages redirects, especially for previously-generated auth-* OpenAPI doc aliases after normalization to human-readable slugs.
Changes:
- Records
auth-*alias redirects during generated API doc cleanup and persists them to a manifest. - Enhances
postbuild-seoto generatebuild/_redirectsby merging multiple redirect sources and validating targets/loops/limits. - Adds a Search Console
.xlsxaudit script and expands test coverage for redirect/alias behaviors.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/postbuild-seo.test.cjs | Adds unit tests for redirect normalization, auth alias mapping, registry behavior, and loop detection. |
| tests/api-sidebar-cleanup.test.cjs | Tests redirect generation for normalized auth alias replacements (slash + no-slash variants). |
| scripts/search-console-redirect-overrides.json | Introduces a curated list of exact redirect overrides based on Search Console exports. |
| scripts/prune-generated-api-aliases.js | Writes a generated auth-alias redirect manifest while normalizing generated auth docs. |
| scripts/postbuild-seo.js | Generates/merges _redirects during postbuild and adds validation + auth alias redirect generation logic. |
| scripts/audit-search-console-coverage.js | Adds a CLI to classify Search Console export URLs against sitemap/build/redirect coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes stale Google/Search Console URLs that were returning 404 after generated
auth-*OpenAPI docs were normalized to human-readable slugs.Root cause
The generation cleanup removed duplicate
auth-*docs and relied on canonical tags/sitemap pruning, but it did not preserve exact 301 redirects for old URLs that Google had already indexed. A later Cloudflare cleanup also avoided broad dynamic redirect rules because those created loop risk.Changes
auth-*alias redirects during API doc cleanup.build/_redirectsduring postbuild by merging generated auth aliases, reviewed Search Console overrides, versioned operation aliases, and slash redirects./docs/user_related_apis_versioned/scopes/unversioned..xlsxcoverage drilldowns.Validation
yarn testyarn buildnode scripts/audit-search-console-coverage.js <six Search Console exports>The local build generated 1,140 static redirects, 0 dynamic redirects, and 0 duplicate sources. All 82 exported
Not found (404)URLs were classified as redirected.