Skip to content

Commit 4638dc5

Browse files
feat: add docusaurus plugin for llmstxt
1 parent ffd5a0b commit 4638dc5

File tree

3 files changed

+230
-162
lines changed

3 files changed

+230
-162
lines changed

docusaurus.config.ts

Lines changed: 186 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ const config: Config = {
3333
docs: {
3434
breadcrumbs: false,
3535
editUrl: editUrlFunction,
36-
exclude: ['adrs/README.md', 'adrs/0000-architectural-decision-records.md', 'adrs/template.md'],
36+
exclude: [
37+
'adrs/README.md',
38+
'adrs/0000-architectural-decision-records.md',
39+
'adrs/template.md',
40+
],
3741
numberPrefixParser: false,
3842
path: 'docs',
3943
beforeDefaultRemarkPlugins: [codeBlockSnippetsPlugin],
@@ -42,8 +46,8 @@ const config: Config = {
4246
[
4347
require('@docusaurus/remark-plugin-npm2yarn'),
4448
{
45-
sync: true, // Sync the tab page across the whole docs website.
46-
converters:['pnpm','yarn'], // Package managers to use.
49+
sync: true, // Sync the tab page across the whole docs website.
50+
converters: ['pnpm', 'yarn'], // Package managers to use.
4751
},
4852
],
4953
],
@@ -66,10 +70,11 @@ const config: Config = {
6670
// Copy tags into sidebar props so we can print tags in DocCard
6771
parseFrontMatter: async (params) => {
6872
const frontmatter = await params.defaultParseFrontMatter(params);
69-
frontmatter.frontMatter.sidebar_custom_props ??= {}
73+
frontmatter.frontMatter.sidebar_custom_props ??= {};
7074
// @ts-expect-error Wrong type
71-
frontmatter.frontMatter.sidebar_custom_props.tags = frontmatter.frontMatter.tags
72-
return frontmatter
75+
frontmatter.frontMatter.sidebar_custom_props.tags =
76+
frontmatter.frontMatter.tags;
77+
return frontmatter;
7378
},
7479
hooks: {
7580
onBrokenMarkdownLinks: process.env.NETLIFY ? 'warn' : 'throw',
@@ -84,15 +89,39 @@ const config: Config = {
8489
return {
8590
resolve: {
8691
symlinks: false,
87-
}
92+
},
8893
};
89-
}
94+
},
9095
};
9196
},
9297
[
93-
'@docusaurus/plugin-client-redirects',
94-
redirectsOptions,
98+
'docusaurus-plugin-llms',
99+
{
100+
docsDir: 'docs',
101+
102+
// Use site metadata in generated headers
103+
title: 'Oasis Documentation',
104+
description: 'Official Oasis developer documentation.',
105+
106+
// Generate both files
107+
generateLLMsTxt: true,
108+
generateLLMsFullTxt: true,
109+
110+
// Clean MDX a bit but keep content readable
111+
excludeImports: true,
112+
removeDuplicateHeadings: true,
113+
114+
// Strip "docs" from URLs to match the deployed site paths
115+
pathTransformation: {
116+
ignorePaths: ['docs'],
117+
},
118+
119+
// Only include Build docs plus the ROFL node guide
120+
includeOrder: ['docs/build/**', 'docs/node/run-your-node/rofl-node.*'],
121+
includeUnmatchedLast: false,
122+
},
95123
],
124+
['@docusaurus/plugin-client-redirects', redirectsOptions],
96125
],
97126
themes: [
98127
[
@@ -104,141 +133,140 @@ const config: Config = {
104133
} satisfies import('@easyops-cn/docusaurus-search-local').PluginOptions,
105134
],
106135
],
107-
themeConfig:
108-
{
109-
navbar: {
110-
logo: {
111-
alt: 'Oasis Docs',
112-
src: 'img/logo.svg',
113-
srcDark: 'img/logo_dark.svg', // Workaround for browsers that don't support @media (prefers-color-scheme: dark) in external SVGs.
114-
// Uncomment src and style below to enable christmas mode ;)
115-
//src: 'img/logo_christmas.svg',
116-
//srcDark: 'img/logo_christmas_dark.svg',
117-
//style: {marginTop: '-13px', marginLeft: '-10px', height: '3rem'},
118-
},
119-
items: [
120-
{
121-
label: 'Build',
122-
to: '/build/',
123-
activeBaseRegex: '/build/',
124-
position: 'left',
125-
},
126-
{
127-
label: 'Learn',
128-
to: '/general/',
129-
activeBaseRegex: '/general/',
130-
position: 'left',
131-
},
132-
{
133-
label: 'Get Involved',
134-
to: '/get-involved/',
135-
position: 'left',
136-
activeBaseRegex: `/get-involved/`,
137-
},
138-
{
139-
label: 'Run Node',
140-
to: '/node/',
141-
activeBaseRegex: '/node/',
142-
position: 'left',
143-
},
144-
{
145-
label: 'Develop Core',
146-
to: '/core/',
147-
position: 'left',
148-
activeBaseRegex: `/core/`,
149-
},
150-
{
151-
href: 'https://github.com/oasisprotocol',
152-
position: 'right',
153-
className: 'header-github-link',
154-
title: 'GitHub repository',
155-
'aria-label': 'GitHub repository',
156-
},
157-
{
158-
href: 'https://oasis.net/',
159-
position: 'right',
160-
className: 'header-www-link',
161-
title: 'Oasis website',
162-
'aria-label': 'Oasis website',
163-
},
164-
],
136+
themeConfig: {
137+
navbar: {
138+
logo: {
139+
alt: 'Oasis Docs',
140+
src: 'img/logo.svg',
141+
srcDark: 'img/logo_dark.svg', // Workaround for browsers that don't support @media (prefers-color-scheme: dark) in external SVGs.
142+
// Uncomment src and style below to enable christmas mode ;)
143+
//src: 'img/logo_christmas.svg',
144+
//srcDark: 'img/logo_christmas_dark.svg',
145+
//style: {marginTop: '-13px', marginLeft: '-10px', height: '3rem'},
165146
},
166-
footer: {
167-
links: [
168-
{
169-
title: 'Tools',
170-
items: [
171-
{
172-
label: 'Explorer',
173-
to: 'https://explorer.oasis.io',
174-
},
175-
{
176-
label: 'Wallet',
177-
to: 'https://wallet.oasis.io',
178-
},
179-
{
180-
label: 'CLI',
181-
to: 'https://github.com/oasisprotocol/cli',
182-
},
183-
{
184-
label: 'Status',
185-
to: 'https://status.oasis.io',
186-
},
187-
],
188-
},
189-
{
190-
title: 'Build',
191-
items: [
192-
{
193-
label: 'Testnet Faucet',
194-
to: 'https://faucet.testnet.oasis.io/',
195-
},
196-
{
197-
label: 'Playground',
198-
to: 'https://playground.oasis.io/',
199-
},
200-
{
201-
label: 'API',
202-
to: 'https://api.docs.oasis.io/',
203-
},
204-
],
205-
},
206-
{
207-
title: 'Node',
208-
items: [
209-
{
210-
label: 'Mainnet',
211-
to: 'node/network/mainnet',
212-
},
213-
{
214-
label: 'Testnet',
215-
to: 'node/network/testnet',
216-
},
217-
],
218-
},
219-
{
220-
title: 'Community',
221-
items: [
222-
{
223-
label: 'Discord',
224-
to: 'https://oasis.io/discord',
225-
},
226-
{
227-
label: 'Telegram',
228-
to: 'https://t.me/oasisprotocolcommunity',
229-
},
230-
{
231-
label: 'Youtube',
232-
to: 'https://www.youtube.com/channel/UC35UFPcZ2F1wjPxhPrSsESQ',
233-
},
234-
{
235-
label: 'GitHub',
236-
to: 'https://github.com/oasisprotocol',
237-
},
238-
],
239-
},
240-
],
241-
copyright: `
147+
items: [
148+
{
149+
label: 'Build',
150+
to: '/build/',
151+
activeBaseRegex: '/build/',
152+
position: 'left',
153+
},
154+
{
155+
label: 'Learn',
156+
to: '/general/',
157+
activeBaseRegex: '/general/',
158+
position: 'left',
159+
},
160+
{
161+
label: 'Get Involved',
162+
to: '/get-involved/',
163+
position: 'left',
164+
activeBaseRegex: `/get-involved/`,
165+
},
166+
{
167+
label: 'Run Node',
168+
to: '/node/',
169+
activeBaseRegex: '/node/',
170+
position: 'left',
171+
},
172+
{
173+
label: 'Develop Core',
174+
to: '/core/',
175+
position: 'left',
176+
activeBaseRegex: `/core/`,
177+
},
178+
{
179+
href: 'https://github.com/oasisprotocol',
180+
position: 'right',
181+
className: 'header-github-link',
182+
title: 'GitHub repository',
183+
'aria-label': 'GitHub repository',
184+
},
185+
{
186+
href: 'https://oasis.net/',
187+
position: 'right',
188+
className: 'header-www-link',
189+
title: 'Oasis website',
190+
'aria-label': 'Oasis website',
191+
},
192+
],
193+
},
194+
footer: {
195+
links: [
196+
{
197+
title: 'Tools',
198+
items: [
199+
{
200+
label: 'Explorer',
201+
to: 'https://explorer.oasis.io',
202+
},
203+
{
204+
label: 'Wallet',
205+
to: 'https://wallet.oasis.io',
206+
},
207+
{
208+
label: 'CLI',
209+
to: 'https://github.com/oasisprotocol/cli',
210+
},
211+
{
212+
label: 'Status',
213+
to: 'https://status.oasis.io',
214+
},
215+
],
216+
},
217+
{
218+
title: 'Build',
219+
items: [
220+
{
221+
label: 'Testnet Faucet',
222+
to: 'https://faucet.testnet.oasis.io/',
223+
},
224+
{
225+
label: 'Playground',
226+
to: 'https://playground.oasis.io/',
227+
},
228+
{
229+
label: 'API',
230+
to: 'https://api.docs.oasis.io/',
231+
},
232+
],
233+
},
234+
{
235+
title: 'Node',
236+
items: [
237+
{
238+
label: 'Mainnet',
239+
to: 'node/network/mainnet',
240+
},
241+
{
242+
label: 'Testnet',
243+
to: 'node/network/testnet',
244+
},
245+
],
246+
},
247+
{
248+
title: 'Community',
249+
items: [
250+
{
251+
label: 'Discord',
252+
to: 'https://oasis.io/discord',
253+
},
254+
{
255+
label: 'Telegram',
256+
to: 'https://t.me/oasisprotocolcommunity',
257+
},
258+
{
259+
label: 'Youtube',
260+
to: 'https://www.youtube.com/channel/UC35UFPcZ2F1wjPxhPrSsESQ',
261+
},
262+
{
263+
label: 'GitHub',
264+
to: 'https://github.com/oasisprotocol',
265+
},
266+
],
267+
},
268+
],
269+
copyright: `
242270
<p xmlns:cc="http://creativecommons.org/ns#" >Copyright © ${new Date().getFullYear()}
243271
by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://oasis.net">
244272
Oasis Protocol Foundation</a>. We <a href="https://oasisprotocol.org/privacy-policy" target="_blank" rel="noopener noreferrer">respect your privacy</a>.
@@ -252,20 +280,20 @@ This does not include the Oasis software and the code examples, both of which ar
252280
licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0"
253281
target="_blank" rel="license noopener noreferrer" style="display:inline-block;">
254282
Apache 2.0</a>. Built with &#x2665; and Docusaurus.</p>`,
255-
},
256-
prism: {
257-
theme: prismThemes.github,
258-
darkTheme: prismThemes.dracula,
259-
additionalLanguages: ['diff', 'rust', 'solidity', 'toml', 'ini'],
260-
},
261-
colorMode: {
262-
respectPrefersColorScheme: true,
263-
},
264-
} satisfies Preset.ThemeConfig,
265-
customFields: {
266-
NODE_ENV: process.env.NODE_ENV,
267-
REACT_APP_FATHOM_SITE_ID: process.env.REACT_APP_FATHOM_SITE_ID,
268-
}
283+
},
284+
prism: {
285+
theme: prismThemes.github,
286+
darkTheme: prismThemes.dracula,
287+
additionalLanguages: ['diff', 'rust', 'solidity', 'toml', 'ini'],
288+
},
289+
colorMode: {
290+
respectPrefersColorScheme: true,
291+
},
292+
} satisfies Preset.ThemeConfig,
293+
customFields: {
294+
NODE_ENV: process.env.NODE_ENV,
295+
REACT_APP_FATHOM_SITE_ID: process.env.REACT_APP_FATHOM_SITE_ID,
296+
},
269297
};
270298

271299
module.exports = config;

0 commit comments

Comments
 (0)