Skip to content

Commit f6ceb1f

Browse files
feat: add llms-full txt link in llmstxt
1 parent 35d3566 commit f6ceb1f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/plugins/llms/generator.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -328,21 +328,28 @@ async function writeLlmsTxt(params: GeneratorParams): Promise<void> {
328328
const optionalSidebars = params.orderedSidebars.filter((name) =>
329329
optionalSet.has(name),
330330
);
331-
if (optionalSidebars.length) {
332-
lines.push('## Optional', '');
333-
for (const sidebarName of optionalSidebars) {
334-
const items = params.docsSidebars[sidebarName];
335-
if (!Array.isArray(items) || !items.length) continue;
336-
337-
const flatEntries = collectFlatDocEntries(items, params.docsById);
338-
for (const entry of flatEntries) {
339-
lines.push(
340-
buildFlatDocLine(entry, params.siteBase, params.maxDescriptionLength),
341-
);
342-
}
331+
332+
// Always include Optional section with llms-full.txt reference (like ElizaOS)
333+
lines.push('## Optional', '');
334+
if (params.siteBase) {
335+
const llmsFullUrl = joinUrl(params.siteBase, params.llmsFullTxtFilename);
336+
lines.push(`- [Docs for LLMs](${llmsFullUrl})`);
337+
} else {
338+
lines.push(`- [Docs for LLMs](/${params.llmsFullTxtFilename})`);
339+
}
340+
341+
for (const sidebarName of optionalSidebars) {
342+
const items = params.docsSidebars[sidebarName];
343+
if (!Array.isArray(items) || !items.length) continue;
344+
345+
const flatEntries = collectFlatDocEntries(items, params.docsById);
346+
for (const entry of flatEntries) {
347+
lines.push(
348+
buildFlatDocLine(entry, params.siteBase, params.maxDescriptionLength),
349+
);
343350
}
344-
lines.push('');
345351
}
352+
lines.push('');
346353

347354
await fsp.writeFile(
348355
path.join(params.outDir, params.llmsTxtFilename),

0 commit comments

Comments
 (0)