Skip to content

Commit 2068008

Browse files
Add llms.txt plugin for Docusaurus to enhance AI accessibility (#91)
* Add llms.txt plugin for Docusaurus to enhance AI accessibility * update site description
1 parent 38d3e1f commit 2068008

3 files changed

Lines changed: 430 additions & 10 deletions

File tree

docusaurus.config.js

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import {themes as prismThemes} from 'prism-react-renderer';
88

99
const EDIT_URL = 'https://github.com/ohcnetwork/docs/tree/main/';
1010

11+
const CURRENT_LOCALE = process.env.DOCUSAURUS_CURRENT_LOCALE ?? 'en';
12+
const IS_DEFAULT_LOCALE = CURRENT_LOCALE === 'en';
13+
1114
/** @type {Array<{id: string, label: string, path: string, routeBasePath: string, sidebarPath: string, sidebarId: string}>} */
1215
const CARE_DEPLOYMENTS = [
1316
{
@@ -145,16 +148,74 @@ const config = {
145148
],
146149
],
147150

148-
plugins: [...CARE_DEPLOYMENTS, ...GUIDE_SECTIONS].map((instance) => [
149-
'@docusaurus/plugin-content-docs',
150-
{
151-
id: instance.id,
152-
path: instance.path,
153-
routeBasePath: instance.routeBasePath,
154-
sidebarPath: instance.sidebarPath,
155-
editUrl: EDIT_URL,
156-
},
157-
]),
151+
plugins: [
152+
...[...CARE_DEPLOYMENTS, ...GUIDE_SECTIONS].map(
153+
(instance) =>
154+
/** @type {import('@docusaurus/types').PluginConfig} */ ([
155+
'@docusaurus/plugin-content-docs',
156+
{
157+
id: instance.id,
158+
path: instance.path,
159+
routeBasePath: instance.routeBasePath,
160+
sidebarPath: instance.sidebarPath,
161+
editUrl: EDIT_URL,
162+
},
163+
])
164+
),
165+
// Generates /llms.txt (+ per-page .md files) so AI agents can read the
166+
// Care docs without scraping HTML. See https://llmstxt.org
167+
// Only for the default (en) locale — the plugin has no per-locale cache.
168+
IS_DEFAULT_LOCALE &&
169+
/** @type {import('@docusaurus/types').PluginConfig} */ ([
170+
'@signalwire/docusaurus-plugin-llms-txt',
171+
/** @type {import('@signalwire/docusaurus-plugin-llms-txt').PluginOptions} */
172+
({
173+
siteTitle: 'Care',
174+
siteDescription:
175+
'Care is an open-source Electronic Medical Record (EMR) platform for managing patients, health workers, and hospitals. It is built and maintained in the open, and contributions of every kind are welcome — code, documentation, bug reports, and translations.',
176+
depth: 3,
177+
enableDescriptions: true,
178+
onRouteError: 'warn',
179+
content: {
180+
enableMarkdownFiles: true,
181+
enableLlmsFullTxt: true,
182+
relativePaths: false,
183+
includeDocs: true,
184+
includePages: true,
185+
// Only index the latest released version; older versions stay out of
186+
// llms.txt so agents don't quote outdated behaviour.
187+
includeVersionedDocs: false,
188+
excludeRoutes: ['/search/**', '/ml/**', '/**/tags/**'],
189+
},
190+
includeOrder: [
191+
'/concepts/**',
192+
'/flows/**',
193+
'/references/**',
194+
'/deployments/**',
195+
'/deployment/**',
196+
'/contributing/**',
197+
'/blog/**',
198+
],
199+
optionalLinks: [
200+
{
201+
title: 'Care (backend) repository',
202+
url: 'https://github.com/ohcnetwork/care',
203+
description: 'Django REST backend source code.',
204+
},
205+
{
206+
title: 'Care frontend repository',
207+
url: 'https://github.com/ohcnetwork/care_fe',
208+
description: 'React frontend source code.',
209+
},
210+
{
211+
title: 'Documentation repository',
212+
url: 'https://github.com/ohcnetwork/docs',
213+
description: 'Source of this documentation site.',
214+
},
215+
],
216+
}),
217+
]),
218+
],
158219

159220
themeConfig:
160221
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */

0 commit comments

Comments
 (0)