LLMs Integration
The Nuxt Content module integrates nuxt-llms
to prepare your content for Large Language Models (LLMs). When nuxt-llms
is detected, Content module automatically extends the LLMs module and inject collections of type page to the LLMs module.🚀
Setup
Install the required module
npm install nuxt-llms
nuxt.config.ts
Configure your
export default defineNuxtConfig({
modules: ['@nuxt/content', 'nuxt-llms'],
llms: {
domain: 'https://your-site.com',
title: 'Your Site Name',
description: 'A brief description of your site',
},
})
That's it 🚀 /llms.txt
file is automatically generated and pre-rendered.
Sections
When generating content, you can create custom sections to process your content into LLM-friendly formats.
You can create custom sections to the llms.sections
array and define the contentCollection
and contentFilters
option for each section.
contentCollection
option, the module will only add page collections to the LLMs module.contentCollection
This option specifies which content collection to use as source.
export default defineNuxtConfig({
llms: {
sections: [
{
title: 'Documentation',
description: 'Technical documentation and guides',
contentCollection: 'docs',
},
],
},
})
contentFilters
This options defines filters to select specific content within the collection.
You precisely control which content is included. Each filter consists of:
field
: The content property to checkoperator
: Comparison operator (=
,<>
,>
,<
,LIKE
,IN
,NOT IN
,IS NULL
,IS NOT NULL
, etc.)value
: The value to compare against
export default defineNuxtConfig({
llms: {
sections: [
{
title: 'Documentation',
description: 'Technical documentation and guides',
contentCollection: 'docs',
contentFilters: [
// Only include markdown files
{ field: 'extension', operator: '=', value: 'md' },
// Only include published content
{ field: 'draft', operator: '<>', value: true },
// Filter by directory
{ field: 'path', operator: 'LIKE', value: '/guide%' },
]
},
],
},
})