fix(seo): canonicalize dotted documentation routes - #19302
Open
sfanahata wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
DESCRIBE YOUR PR
Fixes non-indexable canonical targets for documentation routes whose final segment contains a dot, including Java and Python migration guides such as
7.x-to-8.0and1.x-to-2.x.With
trailingSlash: true, Next.js treats final segments ending in.<word characters>as file-like. Their direct URL has no trailing slash, while the slash form redirects to it. Canonical metadata previously always appended/, so these pages pointed their canonical tag at a redirect.This PR adds one shared
canonicalPathhelper that mirrors Next.js route normalization and uses it for:Linkheaders on.mdresponsesOrdinary documentation routes continue to use trailing slashes. Dotted migration and versioned routes use the direct no-slash form. This supersedes #19004 without its broad content-link or unrelated MD-export changes.
Verification
pnpm test:ci: 377 tests passedpnpm lint:eslint: 0 errors (9 existing warnings)pnpm lint:prettier: passedpnpm lint:ts: passed200and are self-canonical without/308to the no-slash URL200and is self-canonical with/.mdcanonical headers use the same route-aware formsIS YOUR CHANGE URGENT?
PRE-MERGE CHECKLIST