Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| const baseNode = nodeForPath(root, stripVersion(pathname)); | ||
| const baseFrontMatter = getVersion(pathname) | ||
| ? (baseNode?.frontmatter ?? frontMatter) | ||
| : frontMatter; |
Contributor
There was a problem hiding this comment.
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
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
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.
h1_titleoverride for exceptions.>2 AND <4, and MDX interpreted<4as 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 productionnext buildwith a placeholderNEXT_PUBLIC_SENTRY_DSN(all 11,187 pages prerendered, including the failing API route).IS YOUR CHANGE URGENT?
SLA
Please allow the docs team up to one week for review.
PRE-MERGE CHECKLIST