Generate llms.txt, llms-full.txt and Markdown twins of every docs page (OPTIP-478) - #838
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Runs after the static build and converts the rendered HTML to Markdown, so shared partials, generated OpenAPI pages and versioned docs are handled uniformly. Output per product (/<product>/llms.txt, /<product>/llms-full.txt) plus a root /llms.txt index and /llms-full.txt. Unmaintained Player versions (v4-v9), /contributing and /search are excluded. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This comment has been minimized.
This comment has been minimized.
Descriptions come from each page's meta description, which for pages without front matter is a Docusaurus excerpt: drop headings, markup fragments and title repeats, and cap the rest at ~200 characters on a sentence boundary. Sections in the product indexes are now Overview first, alphabetical, with older versions last. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Preview builds kept the production origin with the /pr-<number>/ base URL, so every absolute URL the build emits (canonical, og:url, llms.txt and Markdown links) pointed at optiview.dolby.com/pr-<number>/..., which does not exist. Pass the preview CloudFront origin to the build as DOCUSAURUS_URL so those links resolve on the preview host. Production builds are unchanged. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
MattiasBuelens
left a comment
There was a problem hiding this comment.
/theoplayer/llms.txt has a lot of issues:
- The first link in "Overview" goes to a v10 page?
- There are top-level sections for API references and changelog... but they point to only the Roku API and the React Native changelog.
api-reference
- Player API: Discover all properties and functions of THEOplayer.
changelog
- Changelog: Find out what's new in the OptiView Player.
- The connectors and how-to-guides sections list all connectors and guides of all SDKs. It would make more sense to separate them by SDK.
- There's a very tiny web section? Also with a weird empty code span.
web
- OptiView Hosted Player: Dolby hosts a special version of the OptiView video player for use with customers intended to be used for `` embedding.
Also, how have you tested this? Do LLMs actually manage to find their way around these files?
The product index previously grouped pages by the first URL path segment, which put the v10 landing page in the Overview, produced single-entry api-reference and changelog sections and mixed all platforms in the connectors and how-to-guides sections. Pages are now grouped like the sidebars: one section per top-level sidebar category, prefixed with the SDK name for per-platform sidebars, with the product landing page first and older versions last. Also add explicit descriptions to the two pages whose auto-generated excerpt contained an empty code span. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Thanks for the review — all points from #838 (review) are addressed in a892109. What changed. The product index no longer groups pages by the first URL path segment. It now reads the loaded Docusaurus sidebars (
How it was tested.
I have not yet run this against an external agent (ChatGPT / Claude / Cursor) with the deployed preview URL; happy to do that once the preview for this commit is up if you want more evidence. |
|
Regarding testing: Companies (AI companies too) publish their doc already in this format, e.g. |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Makes the built site consumable by AI tools (ChatGPT, Claude, Cursor, Copilot, …), which today only get rendered HTML and
sitemap.xml. The build now also emits:/docs/llms.txtllms.txt/llms-full.txt(~4.4 KB)/docs/llms-full.txt/docs/<product>/llms.txt## Android SDK: How-to guides,## Roku SDK: Connectors, …); older versions last (## FAQ (10.14.0))/docs/<product>/llms-full.txt/docs/<route>.md/docs/theoplayer/how-to-guides/web/ads/google-ima.mdProducts:
theoplayer,open-video-ui,theolive,millicast,ads,ad-engine. Excluded: Player v4–v9,/contributing,/search, 404. Kept: Player v10, Ads v1, THEOlive v1.How
Markdown is generated from the rendered HTML (not the MDX source) by
@signalwire/docusaurus-plugin-llms-txt, so shared partials,usePlatforms()card lists, generated OpenAPI pages and versioned docs are all handled uniformly. Three local pieces around it:src/plugin/llmsTxt.tswraps the SignalWire plugin and, in the samepostBuild, re-groups its output into the per-product files above (Docusaurus runs pluginpostBuildhooks in parallel, so a separate plugin could not rely on the.mdfiles existing yet). It fails the build if a top-level route has noproductsentry configured. Descriptions come from each page's<meta name="description">; heading/markup fragments, title repeats and empty code spans are dropped, long ones are cut at ~200 chars.src/plugin/llmsTxtSidebars.tsmaps every docs route to its version and its positions in the loaded sidebars (props.plugins[*].content.loadedVersions[*].sidebars). The product index uses this instead of URL paths:Within a section, pages keep their sidebar order.
src/plugin/llmsTxtMarkdown.tscleans up Docusaurus HTML before conversion: Prism token spans → fenced code with language, admonitions → blockquote with bold title, tabs (incl. OpenAPI response tabs) → label + panel in order, strips#hash-links and comments; and fixes the plugin's/docs/docs/duplicated base URL and/route/.mdlink shape.Two pages (
web/hosted-player,getting-started/sdks/web/how-can-we-embed-iframe, current + v10) get an explicitdescriptionfront matter field, because the Docusaurus auto-excerpt turned`<iframe>`into an empty code span in their<meta name="description">.Preview builds use the preview origin
All links in
llms.txt/.mdare absolute (siteConfig.url + baseUrl). Preview builds only changedbaseUrlto/pr-<n>/, so every absolute URL the build emits (canonical,og:url, and now the llms.txt links) pointed atoptiview.dolby.com/pr-<n>/…, which does not exist. The pull-request workflow now passes the preview CloudFront origin to the build:main.ymldoes not set it, so production output is unchanged (https://optiview.dolby.com/docs/…).Verification
npm run build(prod): 1,714 pages; all 1,733 links in the root and productllms.txtfiles resolve to a generated.md; no v4–v9 / contributing / search / pr-N / announcement-bar text in any output; build time unchanged (3m53–4m27 vs 4m24 baseline)./theoplayer/llms.txt: landing page is the first Overview entry; connectors and how-to guides are split per SDK (Web 15/136, Android 11/92, iOS 15/87, React Native 29/6, Roku 9/18, Flutter 0/13); the Roku API reference and React Native changelog sit in their SDK's Overview section; v10 sections come last./open-video-ui/llms.txtis split into Web / Android / React / React Native the same way..mdpage by picking the##section and then the entry.DOCUSAURUS_URL=https://docs-preview.optiview.dolby.com DOCUSAURUS_BASE_URL=/pr-838/ DOCUSAURUS_PR_NUMBER=838 npm run build: all generated absolute links usedocs-preview.optiview.dolby.com/pr-838/, canonical too; preview banner absent from.md.node serve.js:llms*.txt→text/plain,.md→text/markdown, HTML untouched. Deploy is the existingaws s3 sync(content type inferred from extension) — no deploy changes.npm run lint,npm run typecheck,npm run check-formatpass;actionlintreports nothing new on the touched workflow lines.Known limitation
OpenAPI reference pages are client-rendered, so their
.mdcontains only the summary and response codes (parameters/schemas are not in the static HTML). Follow-up tickets are raised.Link to Devin session: https://dolby.devinenterprise.com/sessions/0a1fa7b689f04b478e15356af0b76990
Open in Devin Desktop: https://dolby.devinenterprise.com/desktop/session/0a1fa7b689f04b478e15356af0b76990?variant=devin