Skip to content

fix(seo): canonicalize dotted documentation routes - #19302

Open
sfanahata wants to merge 1 commit into
masterfrom
fix/canonical-dotted-routes
Open

fix(seo): canonicalize dotted documentation routes#19302
sfanahata wants to merge 1 commit into
masterfrom
fix/canonical-dotted-routes

Conversation

@sfanahata

@sfanahata sfanahata commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.0 and 1.x-to-2.x.

How it was fixed:

  • Normal documentation pages use a trailing slash.
  • Pages with filename-like version numbers, such as 7.x-to-8.0, do not.
  • The home page remains /.

We then applied that same rule everywhere Sentry tells search engines about official URLs:

  • The canonical tag inside each page
  • The sitemap submitted to search engines
  • The canonical header attached to Markdown versions of pages
  • Manually configured canonical paths

This PR adds one shared canonicalPath helper that mirrors Next.js route normalization and uses it for:

  • HTML canonical metadata
  • Sitemap URLs
  • Canonical Link headers on .md responses
  • Custom canonical paths

Ordinary documentation routes continue to use trailing slashes. Dotted migration and versioned routes use the direct no-slash form.

Verification

  • pnpm test:ci: 377 tests passed
  • pnpm lint:eslint: 0 errors (9 existing warnings)
  • pnpm lint:prettier: passed
  • pnpm lint:ts: passed
  • Next production compilation completed locally; the full Vercel production build passed
  • Local HTTP verification confirmed:
    • Java and Python dotted routes return 200 and are self-canonical without /
    • Their slash forms return 308 to the no-slash URL
    • An ordinary docs route returns 200 and is self-canonical with /
    • Sitemap and .md canonical headers use the same route-aware forms

IS YOUR CHANGE URGENT?

  • Urgent deadline (GA date, etc.)
  • Other deadline
  • None: Not urgent, can wait up to 1 week+

PRE-MERGE CHECKLIST

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
develop-docs Ready Ready Preview Sep 8, 2026 11:07pm UTC
sentry-docs Ready Ready Preview Sep 8, 2026 11:07pm UTC

Request Review

@sergical sergical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comment otherwise LGTM

Comment thread middleware.ts
const INDEXABLE_HOSTNAMES = new Set([
'docs.sentry.io',
'develop.sentry.dev',
'localhost',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is localhost indexable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants