Skip to content

Commit 4fae85d

Browse files
Generate llms.txt and llms-full.txt files per section (#2501)
* Generate llms.txt and llms-full.txt files per section * remove script and add global page * update dependencies * add path transformation config * edit llms.txt and clean up comments
1 parent aea66d7 commit 4fae85d

File tree

4 files changed

+205
-1088
lines changed

4 files changed

+205
-1088
lines changed

docusaurus.config.js

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,164 @@ const config = {
317317
containerId: 'GTM-5FGPLC2Q',
318318
},
319319
],
320+
[
321+
'docusaurus-plugin-llms',
322+
{
323+
// Set docsDir to site root to collect from all directories
324+
docsDir: '.',
325+
// Disable default files since we're generating section-specific files
326+
generateLLMsTxt: false,
327+
generateLLMsFullTxt: false,
328+
// Ignore common non-doc directories
329+
// Note: src/pages/** is not ignored so tutorials can be collected
330+
// Each customLLMFiles entry filters by includePatterns, so only matching files are included
331+
ignoreFiles: [
332+
'node_modules/**',
333+
'build/**',
334+
'.docusaurus/**',
335+
'static/**',
336+
'src/components/**',
337+
'src/theme/**',
338+
'src/lib/**',
339+
'src/config/**',
340+
'src/hooks/**',
341+
'src/utils/**',
342+
'src/plugins/**',
343+
'src/specs/**',
344+
'src/client/**',
345+
'src/scss/**',
346+
'i18n/**',
347+
'*.config.js',
348+
'*.json',
349+
'*.lock',
350+
'README.md',
351+
'CONTRIBUTING.md',
352+
'gator_versioned_docs/**',
353+
],
354+
excludeImports: true,
355+
removeDuplicateHeadings: true,
356+
// Path transformation to fix URL construction
357+
// Since docsDir is '.', we need to remove 'docs/' prefix and handle src/pages paths
358+
pathTransformation: {
359+
ignorePaths: ['docs', 'src/pages'],
360+
},
361+
// Generate separate files for each section
362+
customLLMFiles: [
363+
{
364+
filename: 'llms-embedded-wallets.txt',
365+
includePatterns: ['embedded-wallets/**/*.{md,mdx}'],
366+
fullContent: false,
367+
title: 'MetaMask Embedded Wallets documentation',
368+
description: 'Documentation links for MetaMask Embedded Wallets',
369+
},
370+
{
371+
filename: 'llms-embedded-wallets-full.txt',
372+
includePatterns: ['embedded-wallets/**/*.{md,mdx}'],
373+
fullContent: true,
374+
title: 'MetaMask Embedded Wallets documentation',
375+
description: 'Complete documentation for MetaMask Embedded Wallets',
376+
},
377+
{
378+
filename: 'llms-sdk.txt',
379+
includePatterns: ['sdk/**/*.{md,mdx}'],
380+
fullContent: false,
381+
title: 'MetaMask SDK documentation',
382+
description: 'Documentation links for MetaMask SDK',
383+
},
384+
{
385+
filename: 'llms-sdk-full.txt',
386+
includePatterns: ['sdk/**/*.{md,mdx}'],
387+
fullContent: true,
388+
title: 'MetaMask SDK documentation',
389+
description: 'Complete documentation for MetaMask SDK',
390+
},
391+
{
392+
filename: 'llms-smart-accounts-kit.txt',
393+
includePatterns: ['smart-accounts-kit/**/*.{md,mdx}'],
394+
fullContent: false,
395+
title: 'MetaMask Smart Accounts Kit documentation',
396+
description: 'Documentation links for MetaMask Smart Accounts Kit',
397+
},
398+
{
399+
filename: 'llms-smart-accounts-kit-full.txt',
400+
includePatterns: ['smart-accounts-kit/**/*.{md,mdx}'],
401+
fullContent: true,
402+
title: 'MetaMask Smart Accounts Kit documentation',
403+
description: 'Complete documentation for MetaMask Smart Accounts Kit',
404+
},
405+
{
406+
filename: 'llms-snaps.txt',
407+
includePatterns: ['snaps/**/*.{md,mdx}'],
408+
fullContent: false,
409+
title: 'Snaps documentation',
410+
description: 'Documentation links for Snaps',
411+
},
412+
{
413+
filename: 'llms-snaps-full.txt',
414+
includePatterns: ['snaps/**/*.{md,mdx}'],
415+
fullContent: true,
416+
title: 'Snaps documentation',
417+
description: 'Complete documentation for Snaps',
418+
},
419+
{
420+
filename: 'llms-wallet.txt',
421+
includePatterns: ['wallet/**/*.{md,mdx}'],
422+
fullContent: false,
423+
title: 'Wallet API documentation',
424+
description: 'Documentation links for Wallet API',
425+
},
426+
{
427+
filename: 'llms-wallet-full.txt',
428+
includePatterns: ['wallet/**/*.{md,mdx}'],
429+
fullContent: true,
430+
title: 'Wallet API documentation',
431+
description: 'Complete documentation for Wallet API',
432+
},
433+
{
434+
filename: 'llms-tutorials.txt',
435+
includePatterns: ['src/pages/tutorials/**/*.{md,mdx}'],
436+
fullContent: false,
437+
title: 'Tutorials',
438+
description: 'Documentation links for MetaMask tutorials',
439+
},
440+
{
441+
filename: 'llms-tutorials-full.txt',
442+
includePatterns: ['src/pages/tutorials/**/*.{md,mdx}'],
443+
fullContent: true,
444+
title: 'Tutorials',
445+
description: 'Complete documentation for MetaMask tutorials',
446+
},
447+
{
448+
filename: 'llms-dashboard.txt',
449+
includePatterns: ['developer-tools/dashboard/**/*.{md,mdx}'],
450+
fullContent: false,
451+
title: 'Developer dashboard documentation',
452+
description: 'Documentation links for MetaMask Developer dashboard',
453+
},
454+
{
455+
filename: 'llms-dashboard-full.txt',
456+
includePatterns: ['developer-tools/dashboard/**/*.{md,mdx}'],
457+
fullContent: true,
458+
title: 'Developer dashboard documentation',
459+
description: 'Complete documentation for MetaMask Developer dashboard',
460+
},
461+
{
462+
filename: 'llms-services.txt',
463+
includePatterns: ['services/**/*.{md,mdx}'],
464+
fullContent: false,
465+
title: 'Services documentation',
466+
description: 'Documentation links for MetaMask services',
467+
},
468+
{
469+
filename: 'llms-services-full.txt',
470+
includePatterns: ['services/**/*.{md,mdx}'],
471+
fullContent: true,
472+
title: 'Services documentation',
473+
description: 'Complete documentation for MetaMask services',
474+
},
475+
],
476+
},
477+
],
320478
],
321479
clientModules: [require.resolve('./src/client/scroll-fix.js')],
322480
themeConfig:

package-lock.json

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
"@docusaurus/remark-plugin-npm2yarn": "3.9.2",
3939
"@docusaurus/theme-common": "3.9.2",
4040
"@docusaurus/theme-mermaid": "3.9.2",
41-
"@mermaid-js/layout-elk": "^0.1.9",
4241
"@intercom/messenger-js-sdk": "^0.0.14",
4342
"@lottiefiles/react-lottie-player": "^3.6.0",
4443
"@mdx-js/react": "^3.1.0",
44+
"@mermaid-js/layout-elk": "^0.1.9",
4545
"@metamask/design-tokens": "^7.1.0",
4646
"@metamask/eth-sig-util": "^7.0.3",
4747
"@metamask/profile-sync-controller": "^16.0.0",
@@ -82,7 +82,8 @@
8282
"remark-codesandbox": "^0.10.1",
8383
"remark-docusaurus-tabs": "^0.2.0",
8484
"remark-math": "^6.0.0",
85-
"sass": "^1.93.0"
85+
"sass": "^1.93.0",
86+
"docusaurus-plugin-llms": "^0.2.2"
8687
},
8788
"devDependencies": {
8889
"@docusaurus/eslint-plugin": "3.9.2",

0 commit comments

Comments
 (0)