Skip to content

docs: Add trailing slashes to internal links to avoid redirects - #19639

Merged
coolguyzone merged 5 commits into
masterfrom
coolguyzone/chore/fix-trailing-slash-inlinks
Sep 29, 2026
Merged

coolguyzone merged 5 commits into
masterfrom
coolguyzone/chore/fix-trailing-slash-inlinks

Conversation

@coolguyzone

@coolguyzone coolguyzone commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

DESCRIBE YOUR PR

Follow-up to #19636. next.config.ts sets trailingSlash: true, so every internal link written without a trailing slash is served a 308 redirect before the page loads. This normalizes those links so they resolve directly, removing one redirect hop each.

NOTE: This work was created programmatically using Claude, I have gone through and verified that these changes make sense and scanned the list of changes, they are all correctly adding trailing slashes to internal links. I am also working on a follow-up PR to auto-fix this issue on new PRs so we don't create new redirect hops.

This is also a consistency fix — trailing slashes were already the dominant convention in this repo before this change (markdown links: 3,197 with vs 248 without; <PlatformLink>: 931 vs 376; url=: 184 vs 76).

  • 811 links across 361 files in docs/, includes/ and platform-includes/
  • Covers markdown links, <Link>, <PlatformLink to="..."> and the url= attribute on <LinkWithPlatformIcon>
  • Anchors handled correctly: /cli/configuration#configuration-file → /cli/configuration/#configuration-file
  • Links inside fenced code blocks, asset paths (/pdfs/*.pdf, images) and API endpoints are left alone
  • Attributes carrying filesystem paths or config values rather than URLs (includePath, path, endpoint, env vars in code samples) are left alone

Deliberately left alone

Versioned pages (__vX.Y.Z) invert the rule — they serve 200 without a trailing slash and 308 with one, so adding a slash would add a hop instead of removing one:

/platforms/javascript/guides/aws-lambda/install/npm__v9.x   -> 200
/platforms/javascript/guides/aws-lambda/install/npm__v9.x/  -> 308

Links with a query string whose path already ends in a slash, e.g. /platform-redirect/?next=%2Ftracing%2F. The slash belongs on the path, not on the query value:

/platform-redirect?next=/tracing/   -> 308
/platform-redirect/?next=/tracing/  -> 200

Verification

  • Every distinct absolute destination was checked against production. Zero 404s. 9 land on pre-existing moved-page redirects that this change shortens rather than introduces (those are docs: Point internal links directly at moved-page destinations #19636's territory).
  • Every changed file differs from origin/master only by added / characters — no slash is removed anywhere and no other content is touched.
  • <PlatformLink> paths are platform-relative, so only the suffix changed; resolution logic is untouched.
  • These changes were regenerated with the linter added in the follow-up enforcement PR, so the two agree by construction.

Noted, not fixed (follow-ups)

  • ~21 pre-existing links to versioned pages that do carry a trailing slash (and so take a needless hop) — left alone here to keep this PR purely mechanical
  • A handful of pre-existing double-slash links (e.g. /security-legal-pii/scrubbing//server-side-scrubbing/)
  • develop-docs/ has ~250 of the same trailing-slash cases; it's a separate site, so it's left for its own PR

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace YYYY-MM-DD with the due date. You can update this information later by editing the PR description.

  • Urgent deadline (GA date, etc.): YYYY-MM-DD
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've supplied a deadline.

Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

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

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-docs Ready Ready Preview Sep 29, 2026 6:13pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Sep 29, 2026 6:13pm UTC

Request Review

@github-actions github-actions Bot added the Priority: Normal Docs review has no urgent deadline label Sep 25, 2026
@codeowner-assignment
codeowner-assignment Bot requested review from a team and ryan953 September 25, 2026 22:45
@coolguyzone
coolguyzone removed request for a team and ryan953 September 28, 2026 18:55
@coolguyzone
coolguyzone force-pushed the coolguyzone/chore/fix-trailing-slash-inlinks branch from 294ac31 to a952706 Compare September 28, 2026 18:59
@codeowner-assignment
codeowner-assignment Bot requested review from a team and ryan953 September 28, 2026 19:00
coolguyzone added a commit that referenced this pull request Sep 28, 2026
The linter only matched targets starting with `/`, so it silently enforced
half the rule. Relative links resolve in the browser against the current
page and are requested verbatim, so a missing slash is still a 308:
docs.sentry.io renders `href="../tags"` today, and that request 308s to
the canonical `.../tags/`.

The gap was larger than the bucket already fixed in #19639. Across
docs/, includes/ and platform-includes/ the link forms are:

  5364  absolute /foo          (was covered)
  4247  external http(s)       (correctly ignored)
  2385  relative ../foo ./foo  (was NOT covered)
   864  bare anchor #foo       (correctly ignored)
    84  bare relative foo/bar  (was NOT covered)

Matching those raises the repo-wide count from 1088 to 2189.

Tightening the pattern mattered as much as widening it. A bare-relative
branch that accepts any non-scheme text also matches an angle-bracket
autolink whose URL contains parentheses -- ``[`main()`](<https://…/main(_:)>)``
-- and appending a slash there corrupts the URL. Site paths never contain
`(`, `<` or `>`, so those are excluded from the path characters, which
removed all 15 such false positives. Protocol-relative `//host` is
exempted too, since it is external rather than a site path.

Verified: `--fix` over the whole corpus changes 2189 links across 475
files with zero non-slash content changes, zero slash removals and zero
external URLs altered. Resolved relative destinations spot-checked
against production all return 200.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
coolguyzone and others added 2 commits September 29, 2026 10:59
…ix-trailing-slash-inlinks

# Conflicts:
#	docs/platforms/python/integrations/index.mdx
#	docs/product/agents/getting-started.mdx
#	docs/product/issues/issue-details/index.mdx
The three files that conflicted were resolved with master's version, so
the trailing-slash pass is re-run over them here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codeowner-assignment
codeowner-assignment Bot requested review from a team and ryan953 September 29, 2026 18:00
@coolguyzone
coolguyzone removed request for a team and ryan953 September 29, 2026 18:03
@coolguyzone
coolguyzone enabled auto-merge (squash) September 29, 2026 18:04
@coolguyzone
coolguyzone merged commit 18a6a20 into master Sep 29, 2026
21 of 22 checks passed
@coolguyzone
coolguyzone deleted the coolguyzone/chore/fix-trailing-slash-inlinks branch September 29, 2026 18:17

This branch was successfully deployed

1 active deployment
Preview – sentry-docs — dc84de55 Deployed Sep 29, 2026 by vercel[bot]
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