Skip to content

Commit 38e57ec

Browse files
committed
feat(nuxt-llms): rewriteLLMSTxt option to disable rewriting paths in llms.txt
1 parent a0763cd commit 38e57ec

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/features/llms/module.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ import type { SQLOperator, PageCollections, PageCollectionItemBase } from '@nuxt
3737
declare module 'nuxt-llms' {
3838
interface ModuleOptions {
3939
contentRawMarkdown?: false | {
40+
/**
41+
* Whether to rewrite the LLMs.txt file to use the raw markdown endpoint
42+
* @default true
43+
*/
44+
rewriteLLMSTxt?: boolean
45+
/**
46+
* Whether to exclude specific collections from the raw markdown endpoint
47+
* @default []
48+
*/
4049
excludeCollections?: string[]
4150
}
4251
}

src/features/llms/runtime/server/content-llms.plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export default defineNitroPlugin((nitroApp: NitroApp) => {
9191
}
9292

9393
function getDocumentLink(link: string, collection: string, options: ModuleOptions) {
94-
const contentRawMarkdown = (options as unknown as { contentRawMarkdown: false | { excludeCollections: string[] } })?.contentRawMarkdown
95-
if (contentRawMarkdown === false || contentRawMarkdown?.excludeCollections?.includes(collection)) {
94+
const contentRawMarkdown = (options as unknown as { contentRawMarkdown: false | { rewriteLLMSTxt: boolean, excludeCollections: string[] } })?.contentRawMarkdown
95+
if (contentRawMarkdown === false || contentRawMarkdown?.rewriteLLMSTxt === false || contentRawMarkdown?.excludeCollections?.includes(collection)) {
9696
return withBase(link, options.domain)
9797
}
9898

0 commit comments

Comments
 (0)