Skip to content

fix(docs): the rate limits card was invisible in the On this page index - #95

Merged
sre-helmcode merged 1 commit into
mainfrom
feat/rate-limits-toc
Sep 21, 2026
Merged

sre-helmcode merged 1 commit into
mainfrom
feat/rate-limits-toc

Conversation

@sre-helmcode

Copy link
Copy Markdown
Contributor

nan.builders/docs/models publishes the raised rate limits, but the 'On this page' index never mentioned the section: the docs layout builds that TOC client-side by scraping rendered h2/h3 inside .docs-content (Docs.astro), and the rate limits card stack embedded from models.mdx rendered no heading at all.

What changed

  • RateLimits.astro opens with a real <h2> carrying data-toc-text — the same pattern ModelCard.astro already uses so badges stay out of the TOC.
  • The heading text routes through rateLimitsLabels() so each locale keeps its own wording: 'Rate limits' / 'Límites de peticiones' (user-picked label).
  • rateLimitsI18n.test.ts now covers the label translation in both directions and pins the heading contract the TOC scraper depends on (<h2 id="rate-limits" data-toc-text={T.sectionHeading}>).

Test plan

  • npm test: 66 files / 1303 tests passed
  • npm run build exit 0; the ES label is present in the built server chunk
  • Targeted vitest run on rateLimits + rateLimitsI18n (27 tests) before the full suite

Deploy notes

No VERSION file in this repo; merging to main triggers the Cloudflare Pages deploy via deploy.yml. After deploy, check that /docs/models and /es/docs/models list the section under 'On this page'.

The docs layout builds 'On this page' client-side by scraping rendered
h2/h3 inside .docs-content (Docs.astro). The rate limits card stack
embedded from models.mdx rendered no heading at all, so /docs/models'
TOC never mentioned the section even though the limits are published
there.

RateLimits.astro now opens with a real h2 carrying data-toc-text (the
ModelCard pattern), with its text routed through rateLimitsLabels so
each locale keeps its own wording: 'Rate limits' / 'Límites de
peticiones'. The i18n suite covers both the label translation and the
heading contract the TOC scraper depends on.
@sre-helmcode
sre-helmcode merged commit 2956096 into main Sep 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants