Skip to content

fix(docs): Disambiguate SDK page H1 headings - #19630

Open
sfanahata wants to merge 3 commits into
masterfrom
shannon/fix-sdk-duplicate-h1s
Open

sfanahata wants to merge 3 commits into
masterfrom
shannon/fix-sdk-duplicate-h1s

Conversation

@sfanahata

@sfanahata sfanahata commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

DESCRIBE YOUR PR

SDK and platform docs currently render short frontmatter titles as H1s, causing thousands of duplicate headings across guides. Derive a descriptive visible H1 from the docs tree while keeping short titles for breadcrumbs, navigation, and metadata.

  • Name landing pages "Sentry for React" / "Sentry for PHP" and qualify guide names shared by SDK families, such as AWS Lambda (.NET) vs JavaScript.
  • Add guide context to topic pages and section context when needed: "Session Replay Configuration for Effect" vs "User Feedback Configuration for Effect".
  • Give versioned pages the current page heading plus their SDK version; support an explicit h1_title override for exceptions.
  • Keep H1 changes scoped to SDK/platform docs.
  • Fix the preview build failure on the API custom inbound filter page: OpenAPI prose contains >2 AND <4, and MDX interpreted <4 as a JSX tag. Escape numeric comparisons before compiling API descriptions. Includes a regression test.

Verification: pnpm generate-doctree; generated-tree audit found 0 repeated H1s across 10,467 distinct SDK/platform URLs (including versioned URLs). pnpm test:ci (410 passed), pnpm lint (passes, 9 existing unrelated warnings), git diff --check, and production next build with a placeholder NEXT_PUBLIC_SENTRY_DSN (all 11,187 pages prerendered, including the failing API route).

IS YOUR CHANGE URGENT?

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

SLA

Please allow the docs team up to one week for review.

PRE-MERGE CHECKLIST

  • 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

@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
develop-docs Ready Ready Preview Sep 25, 2026 7:25pm UTC
sentry-docs Ready Ready Preview Sep 25, 2026 7:25pm UTC

Request Review

Comment thread src/sdkPageHeading.ts
Comment thread src/sdkPageHeading.ts
const baseNode = nodeForPath(root, stripVersion(pathname));
const baseFrontMatter = getVersion(pathname)
? (baseNode?.frontmatter ?? frontMatter)
: frontMatter;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: A versioned page's h1_title is ignored if the base (unversioned) page exists but lacks an h1_title. The heading falls back to auto-generation instead of using the override.
Severity: MEDIUM

Suggested Fix

The logic should be updated to prioritize the versioned page's h1_title if it exists. A potential fix is to merge the frontmatter objects, giving precedence to the versioned page's properties. For example, const baseFrontMatter = getVersion(pathname) ? { ...frontMatter, ...baseNode?.frontmatter } : frontMatter; would ensure the version-specific h1_title is used while falling back to the base page's otherwise.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sdkPageHeading.ts#L103

Potential issue: When generating a heading for a versioned page, the logic at lines
101-103 in `sdkPageHeading.ts` incorrectly prioritizes the frontmatter of the base
(unversioned) page. If the base page exists but does not define an `h1_title`, any
`h1_title` specified in the versioned page's frontmatter is silently ignored. Instead of
using the intended override, the system falls back to its auto-generation logic. This
prevents developers from setting custom H1 titles for specific versions of a document
when a base document is present.

This branch was successfully deployed

2 active deployments
Preview – sentry-docs — d0f89251 Deployed Sep 25, 2026 by vercel[bot]
Preview – develop-docs — d0f89251 Deployed Sep 25, 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.

1 participant