Repository navigation
fix(api-reference): M-25047456 move the spec out of API page HTML - #1333
Merged
Merged
Conversation
… page HTML ApiReferenceLayout passed the whole openapi.yaml to <ApiReference client:load> as a prop, so Astro serialized ~2.1 MB of spec into every /docs/api page. The <h1> landed at byte ~2,215,000, past Googlebot's 2 MB fetch cutoff, and none of the 486 API pages got crawled. ApiReference now imports openapi.yaml?raw itself and the rawYaml prop is gone, so the spec ships once in the hashed island chunk (only API pages load it). API page HTML drops to 126-164 KB with the <h1> before byte ~124 KB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Merge Verdict
[APPROVE] — API page HTML drops from ~2.2 MB to ~136 KB and the
<h1>moves from byte ~2,215,000 to ~115,000, inside Googlebot's 2 MB fetch window; behavior is unchanged.Requirement: M-25047456 (sitemap coverage: none of the 486
/docs/api/*pages has been crawled by Google).Summary
ApiReferenceLayout.astropassed the wholeopenapi.yamlstring as a prop to<ApiReference client:load>. Astro serializes island props into the page HTML, so every API page carried ~2.1 MB of spec before its content. Googlebot only fetches the first 2 MB (uncompressed) of an HTML document, so the<h1>, body and sidebar links never reached it.ApiReference.tsxnow imports../../../openapi.yaml?rawitself (same pattern asQuotePermission.tsx/openapi-markdown.ts), and therawYamlprop is removed. The spec ships once in the hashed island chunk, which only the API pages load and browsers cache across pages.Risk Analysis
ApiReferenceLayout.astrois the only place that renders<ApiReference>;rgfinds no other callerassets/index.<hash>.js, referenced by the 486 API pages and by no docs / home pageDesign Decisions
parseSpecor to how the reference renders; this PR only moves where the bytes live.Code Concerns
packages/api-reference/src/ApiReference.tsx:30)assets/index.<hash>.jsis 2,164,371 bytes uncompressed. If Google's renderer truncates it, the island won't hydrate for the bot; indexing is unaffected because the static HTML already holds the full content. Splitting the spec per locale or shipping it pre-parsed would bring it under 2 MB — follow-up if we want the rendered view to match.Verification
bun run build:canary<h1>at most byte 123,344 across all 486 API pages<h1>, missing title, or < 161 API linksopen.longbridge.xyz,open-canary.longbridge.xyz)/docs/api/dividends135,851 B / 137,013 B,<h1>at 114,104 / 115,204Conclusion basis
astro previewand both canary hosts measured with curl and checked in the browser.build:releaseand thecnregion build were not run.🤖 Generated with Claude Code