Skip to content

[Docs] Add JSON-LD and llms.txt for AI search - #4458

Merged
m-bert merged 4 commits into
software-mansion:mainfrom
halskiszymon:geo-structured-data
Aug 20, 2026
Merged

[Docs] Add JSON-LD and llms.txt for AI search#4458
m-bert merged 4 commits into
software-mansion:mainfrom
halskiszymon:geo-structured-data

Conversation

@halskiszymon

Copy link
Copy Markdown
Contributor

Two SEO changes for the docs site. Nothing changes the rendered page.

  • JSON-LD: Organization with the same @id as swmansion.com, plus SoftwareSourceCode for the library, derived from siteConfig. The identical @id is 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.

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.
Copilot AI lite review requested due to automatic review settings August 20, 2026 08:58
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b549ef1-edfa-4318-86cb-eb0c9dfbdb52

📥 Commits

Reviewing files that changed from the base of the PR and between 389e5b3 and ebfa987.

📒 Files selected for processing (1)
  • .github/workflows/docs-check.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/docs-check.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Documentation pages now include structured metadata for software and organization details.
    • Automatically generates an llms.txt file with documentation page links, titles, and descriptions.
    • Documentation output supports improved machine-readable page listings.
  • Bug Fixes

    • Documentation checks now detect missing, empty, or incomplete llms.txt files during builds.
    • Builds fail when the generated documentation listing does not contain valid page links.

Walkthrough

The documentation build now adds JSON-LD metadata, generates a grouped build/llms.txt file from route HTML, and validates the file in the documentation workflow.

Changes

Documentation metadata and discovery

Layer / File(s) Summary
Metadata helpers and structured data
packages/docs-gesture-handler/plugins/swm-geo.js
The plugin parses HTML metadata, generates Organization and SoftwareSourceCode JSON-LD, and exports the generator helpers.
Docusaurus plugin and llms.txt build
packages/docs-gesture-handler/docusaurus.config.js, packages/docs-gesture-handler/plugins/swm-geo.js
Docusaurus loads the swm-geo plugin. The plugin injects JSON-LD into page heads and generates grouped build/llms.txt content during postBuild.
Generated file validation
.github/workflows/docs-check.yml
The workflow checks that llms.txt exists, is non-empty, and contains documentation page links.

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
Loading
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main changes: adding JSON-LD metadata and generating llms.txt for AI search.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 generates llms.txt during postBuild.
  • Register the plugin in docusaurus.config.js.
  • Add a GitHub Actions step that fails the docs build if llms.txt is 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.

Comment thread packages/docs-gesture-handler/plugins/swm-geo.js
A title containing regex metacharacters would change the pattern's meaning or
throw at build time.
@halskiszymon
halskiszymon marked this pull request as ready for review August 20, 2026 09:19
Comment thread .github/workflows/docs-check.yml Outdated
@m-bert m-bert added the Documentation Documentation change/enhancement label Aug 20, 2026
@m-bert m-bert changed the title Add JSON-LD and llms.txt for AI search [Docs] Add JSON-LD and llms.txt for AI search Aug 20, 2026
@m-bert
m-bert merged commit d064b66 into software-mansion:main Aug 20, 2026
3 checks passed
m-bert pushed a commit that referenced this pull request Aug 21, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Documentation change/enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants