Skip to content

Group SDK-scoped pages under sub-headers in /docs/llms.txt#3354

Open
NWylynko wants to merge 2 commits intomainfrom
cursor/llms-txt-sdk-subheaders-859f
Open

Group SDK-scoped pages under sub-headers in /docs/llms.txt#3354
NWylynko wants to merge 2 commits intomainfrom
cursor/llms-txt-sdk-subheaders-859f

Conversation

@NWylynko
Copy link
Copy Markdown
Contributor

@NWylynko NWylynko commented May 8, 2026

🔎 Previews:

What does this solve? What changed?

Restructures the auto-generated /docs/llms.txt overview so that SDK-scoped pages are grouped under per-SDK sub-headers, instead of being interleaved as one flat list. Generic (non-SDK) pages are listed first under ## Docs, then each SDK gets its own ### <SDK Display Name> section.

For example:

# Clerk

## Docs

- [Generic Doc]({{SITE_URL}}/docs/generic-doc)

### Next.js

- [SDK Doc]({{SITE_URL}}/docs/nextjs/sdk-doc)

### React

- [SDK Doc]({{SITE_URL}}/docs/react/sdk-doc)

A page is treated as SDK-scoped if any directory segment in its path matches a known SDK. This covers two patterns:

  1. SDK-variant outputs from the build, e.g. nextjs/api-doc.mdx.
  2. Reference-style docs that live under a non-SDK top-level folder, e.g. reference/vue/clerk-plugin.mdx, reference/astro/clerk-middleware.mdx, reference/nuxt/integration.mdx.

The trailing filename segment is intentionally excluded so a generic doc like guides/.../core-2/expo.mdx is not misclassified as an Expo-scoped page.

Two URL slugs don't match their SDK key, so they're recognized via an alias map:

  • javascriptjs-frontend
  • expressexpressjs

Implementation details:

  • scripts/lib/llms.tswriteLLMs buckets pages with getSdkFromPath, which scans directory segments and consults PATH_SEGMENT_SDK_ALIASES. Generic pages are emitted first; SDK sections follow in the order defined by validSdks for stable, deterministic output. A SDK_DISPLAY_NAMES map provides human-friendly section titles (e.g. nextjsNext.js, tanstack-react-startTanStack React Start, js-frontendJavaScript).
  • scripts/build-docs.ts – passes config.validSdks into writeLLMs so the grouping logic shares the canonical SDK list.
  • scripts/build-docs.test.ts – adds two new tests:
    • Should group SDK-scoped pages under sub-headers in llms.txt overview – covers the SDK-variant case (dist/<sdk>/foo.mdx).
    • Should group reference/<sdk>/ pages and URL-aliased SDKs under their SDK sub-header – covers reference/vue, reference/astro, reference/javascript (→ js-frontend) and reference/express (→ expressjs).

All 150 existing build-docs tests pass.

Deadline

  • No rush

Other resources

Open in Web Open in Cursor 

Pages whose path begins with a known SDK segment (e.g. nextjs/foo.mdx)
are now listed under a '### <SDK Display Name>' sub-header, after the
generic pages, in /docs/llms.txt. SDK sections are emitted in the order
defined by VALID_SDKS for stable output.

Co-authored-by: Nick Wylynko <nick@wylynko.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
clerk-docs Ready Ready Preview May 8, 2026 4:28pm

Request Review

Reference docs like docs/reference/vue/clerk-plugin.mdx live under a
non-SDK top-level directory but are scoped to a single SDK. Detect the
SDK from any directory segment in the path (skipping the trailing file
segment so e.g. core-2/expo.mdx isn't misclassified) and add aliases
for path slugs that don't match the SDK key:

- javascript -> js-frontend
- express   -> expressjs

Co-authored-by: Nick Wylynko <nick@wylynko.com>
@NWylynko NWylynko marked this pull request as ready for review May 8, 2026 16:54
@NWylynko NWylynko requested a review from a team as a code owner May 8, 2026 16:54
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