[Docs] Add JSON-LD and llms.txt for AI search - #4458
Conversation
One local plugin injects Organization and SoftwareSourceCode structured data using the same @id as swmansion.com, and writes llms.txt from the pages Docusaurus just built. CI fails if the file is missing or lists nothing.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe documentation build now adds JSON-LD metadata, generates a grouped ChangesDocumentation metadata and discovery
Sequence Diagram(s)sequenceDiagram
participant Docusaurus
participant swmGeoPlugin
participant BuiltRouteHTML
participant BuildOutput
participant DocsWorkflow
Docusaurus->>swmGeoPlugin: run postBuild
swmGeoPlugin->>BuiltRouteHTML: read route HTML
BuiltRouteHTML-->>swmGeoPlugin: return page metadata
swmGeoPlugin->>BuildOutput: write build/llms.txt
DocsWorkflow->>BuildOutput: validate llms.txt
BuildOutput-->>DocsWorkflow: return file and link status
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds two SEO-related outputs to the Docusaurus docs build for react-native-gesture-handler: JSON-LD structured data injected into the HTML head, and a build-generated llms.txt that enumerates docs pages. It also adds a CI gate to ensure llms.txt is generated and non-empty.
Changes:
- Add a local Docusaurus plugin that injects JSON-LD (
Organization+SoftwareSourceCode) and generatesllms.txtduringpostBuild. - Register the plugin in
docusaurus.config.js. - Add a GitHub Actions step that fails the docs build if
llms.txtis missing/empty or contains no page entries.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/docs-gesture-handler/plugins/swm-geo.js | New plugin to inject JSON-LD and generate llms.txt from built HTML pages/routes. |
| packages/docs-gesture-handler/docusaurus.config.js | Registers the new local plugin in the docs site config. |
| .github/workflows/docs-check.yml | Adds a CI validation step to ensure llms.txt exists and lists at least one page. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A title containing regex metacharacters would change the pattern's meaning or throw at build time.
Follow-up to #4458. `JSON.stringify` leaves `<` unescaped, so a `</script>` inside any `siteConfig` value would close the script tag early. Escaped to `\u003c`. Raised by Copilot on the same plugin in react-native-enriched-html#782; this is the same one-line fix.
Two SEO changes for the docs site. Nothing changes the rendered page.
Organizationwith the same@idas swmansion.com, plusSoftwareSourceCodefor the library, derived fromsiteConfig. The identical@idis what makes engines read the docs and the company site as one entity instead of two unrelated ones.llms.txt, generated at build — no new dependency. Lists every docs page. The docs build now fails if the file is missing or lists nothing.Both come from one local plugin,
plugins/swm-geo.js, registered with a single line. The same change is going out across the docs repos; reference: software-mansion/react-native-reanimated#10332.Check: CI prints
llms.txt lists N pages.