You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor LLMs generation and add static root index
Switch from auto-generating a monolithic llms.txt/llms-full.txt to a hand-curated static/llms.txt and per-section indexes. Wrap docusaurus-plugin-llms with an llms-html-injector wrapper so generation runs before post-processing (normalizing .md layout, rewriting llms*.txt URLs, and injecting <link rel="alternate">). Update docusaurus.config.js to disable the classic docs slot, disable root/full LLM generators, and adjust path transformations. Update scripts/verify-llms-output.js to mirror the new behavior (customLLMFiles list, disabled root generators, post-process step, and copy static/llms.txt into the verify outDir). Add static/llms.txt, add vercel redirects for the removed whats-new page, remove docs/whats-new.md, and tweak a navbar CSS comment. Export postProcessLlmsOutput for reuse by the verify script.
// The classic preset's `docs` plugin is disabled. It previously
166
+
// rendered a single orphan page (`docs/whats-new.md`) at `/whats-new/`
167
+
// that pointed offsite for release notes. The page had no incoming
168
+
// internal links and is redirected to `/` in `vercel.json`. Per-product
169
+
// documentation is served by dedicated `plugin-content-docs` instances
170
+
// configured below in `plugins`, not by this preset slot.
171
+
docs: false,
175
172
pages: {
176
173
path: 'src/pages',
177
174
routeBasePath: '/',
@@ -323,39 +320,32 @@ const config = {
323
320
containerId: 'GTM-5FGPLC2Q',
324
321
},
325
322
],
323
+
// The llms-html-injector plugin wraps docusaurus-plugin-llms so that
324
+
// generation (per-section `llms-<product>.txt` files and per-page `.md`
325
+
// files) runs sequentially before our post-processing (path normalization,
326
+
// index URL rewrites, and `<link rel="alternate" type="text/markdown">`
327
+
// injection). Wrapping is required because Docusaurus 3.x executes
328
+
// `postBuild` hooks concurrently via `Promise.all`, so registering both
329
+
// plugins separately would let the injector race against the generator.
326
330
[
327
-
'docusaurus-plugin-llms',
331
+
'./src/plugins/llms-html-injector',
328
332
{
329
333
// Set docsDir to site root to collect from all directories
330
334
docsDir: '.',
331
-
// Generate a comprehensive root llms.txt + llms-full.txt covering every page
332
-
// (Agent Score: llms-txt-coverage check). The per-section files below remain
333
-
// useful as scoped indexes for AI tools.
334
-
generateLLMsTxt: true,
335
-
generateLLMsFullTxt: true,
336
-
// Emit an individual .md file next to every doc page so .md URLs return 200
337
-
// (Agent Score: markdown-url-support and llms-txt-directive-md checks). The
338
-
// companion llms-html-injector plugin (registered below) normalizes these
335
+
// The root llms.txt is hand-curated at static/llms.txt to stay under
336
+
// the AFDocs 50,000-char `llms-txt-size` threshold. The aggregate
337
+
// walker descends one level into the per-section indexes listed below,
338
+
// so coverage is preserved without dumping every page into a flat
339
+
// index. Likewise, a monolithic llms-full.txt would exceed every
340
+
// agent's context window (and crashes browser tabs at multi-MB
341
+
// sizes); the per-section *-full.txt files cover the bulk content.
342
+
generateLLMsTxt: false,
343
+
generateLLMsFullTxt: false,
344
+
// Emit an individual .md file next to every doc page so .md URLs
345
+
// return 200 (Agent Score: markdown-url-support and
346
+
// llms-txt-directive-md checks). The wrapper below normalizes these
339
347
// files to URL-aligned paths and injects <link rel="alternate"> tags.
340
348
generateMarkdownFiles: true,
341
-
// Custom framing for the root index, preserving the prose previously
342
-
// hand-maintained in static/llms.txt.
343
-
rootContent: `> MetaMask is the leading self-custodial cryptocurrency wallet and Web3 gateway, enabling developers to build dapps that connect to the MetaMask browser extension and mobile app across EVM and Solana ecosystems.
344
-
345
-
This file follows the [llmstxt.org](https://llmstxt.org/) specification. Section-scoped indexes are also available:
fullRootContent: `> MetaMask is the leading self-custodial cryptocurrency wallet and Web3 gateway, enabling developers to build dapps that connect to the MetaMask browser extension and mobile app across EVM and Solana ecosystems.
356
-
357
-
This file contains the complete MetaMask developer documentation in a single markdown document, following the [llmstxt.org](https://llmstxt.org/) specification.
358
-
`,
359
349
// Ignore common non-doc directories
360
350
// Note: src/pages/** is not ignored so tutorials can be collected
361
351
// Each customLLMFiles entry filters by includePatterns, so only matching files are included
@@ -397,10 +387,13 @@ This file contains the complete MetaMask developer documentation in a single mar
397
387
],
398
388
excludeImports: true,
399
389
removeDuplicateHeadings: true,
400
-
// Path transformation to fix URL construction
401
-
// Since docsDir is '.', we need to remove 'docs/' prefix and handle src/pages paths
390
+
// Strip `src/pages` from generated URLs so a file at
391
+
// `src/pages/quickstart/foo.md` resolves to `/quickstart/foo/` to
392
+
// match the public route. `docsDir` is `.` (the site root) so any
393
+
// future top-level prefixes that should be hidden from URLs would
394
+
// be added here.
402
395
pathTransformation: {
403
-
ignorePaths: ['docs','src/pages'],
396
+
ignorePaths: ['src/pages'],
404
397
},
405
398
// Generate separate files for each section
406
399
customLLMFiles: [
@@ -519,11 +512,6 @@ This file contains the complete MetaMask developer documentation in a single mar
519
512
],
520
513
},
521
514
],
522
-
// Runs in postBuild after docusaurus-plugin-llms generates files. Normalizes
523
-
// .md files to URL-aligned paths, rewrites llms*.txt URLs to match, and
524
-
// injects <link rel="alternate" type="text/markdown"> into every doc page's
0 commit comments