Skip to content

Add script for generating llms.txt#4590

Merged
Simek merged 9 commits into
react:mainfrom
szymonrybczak:feat/ai/llms.txt
Apr 29, 2025
Merged

Add script for generating llms.txt#4590
Simek merged 9 commits into
react:mainfrom
szymonrybczak:feat/ai/llms.txt

Conversation

@szymonrybczak

Copy link
Copy Markdown
Contributor

What

Adds a script that generates llms.txt - a single file containing all React Native documentation in a format optimized for LLMs. The file is generated during the website build process.

Why

  • Makes it easier for LLMs to understand and reference React Native documentation
  • Provides a single, clean source of truth for documentation
  • Helps LLMs give more accurate and up-to-date answers about React Native

How

  • New script scripts/generate-llms-txt.js that:
    • Parses sidebar config
    • Validates all doc URLs
    • Generates a clean markdown file
  • Added to build process
  • Added to .gitignore

Testing

  • Verified all URLs are valid
  • Checked generated markdown structure
  • Tested build process

@netlify

netlify Bot commented Apr 23, 2025

Copy link
Copy Markdown

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit 6123259
🔍 Latest deploy log https://app.netlify.com/sites/react-native/deploys/68110aee03bf0c000884e20b
😎 Deploy Preview https://deploy-preview-4590--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@cortinico cortinico requested a review from Simek April 23, 2025 16:29

@Simek Simek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start! 👌 Left few comments and suggestions above.

Can we also include in list Contributing and Community sections content? Since you already have a way to read and covert sidebar data, it should be matter of concatenation of multiple outputs.

Comment thread scripts/generate-llms-txt.js Outdated
Comment thread scripts/generate-llms-txt.js Outdated
Comment thread scripts/generate-llms-txt.js
Comment thread scripts/generate-llms-txt.js Outdated
Comment thread scripts/generate-llms-txt.js Outdated
Comment thread website/package.json Outdated
szymonrybczak and others added 6 commits April 24, 2025 14:26
Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>
Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>
Co-authored-by: Bartosz Kaszubowski <gosimek@gmail.com>
@szymonrybczak

szymonrybczak commented Apr 28, 2025

Copy link
Copy Markdown
Contributor Author

Can we also include in list Contributing and Community sections content? Since you already have a way to read and covert sidebar data, it should be matter of concatenation of multiple outputs.

It required more changes that I initially expected, but I managed to combine all of them (also included the architecture one) 👍

@szymonrybczak szymonrybczak requested a review from Simek April 28, 2025 21:49

@Simek Simek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all of the updates! Tested the latest version locally, looks great! 👍

Few last cleanup nits below, let's address those before shipping.

Comment thread scripts/generate-llms-txt.js Outdated
Comment thread scripts/generate-llms-txt.js Outdated
@szymonrybczak

Copy link
Copy Markdown
Contributor Author

@Simek fixed! Should be g2g now 🫡

@Simek Simek merged commit 8c79bad into react:main Apr 29, 2025
4 checks passed
@slorber

slorber commented May 14, 2025

Copy link
Copy Markdown
Contributor

Hey

Is providing a llms.txt that useful? Any crawler/LLM use that already?

Considering people are implementing this, I was wondering if it's worth creating an official Docusaurus plugin

@szymonrybczak

Copy link
Copy Markdown
Contributor Author

hey @slorber, I think it's becoming kind of standard, and the most popular standard so far.

Considering people are implementing this, I was wondering if it's worth creating an official Docusaurus plugin

That'd be really cool to automate this kind of stuff. For example Docusaurus already did a official plugin for it: web-infra-dev/rspress#2034

@slorber

slorber commented May 23, 2025

Copy link
Copy Markdown
Contributor

I reopened our repo issue since if we don't provide this, it seems that every docs will implement their own anyway 😅

facebook/docusaurus#10899

coado pushed a commit to coado/react-native-website that referenced this pull request Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants