Skip to content

Commit 7f98a3a

Browse files
authored
docs(advanced): update llms page
1 parent c334384 commit 7f98a3a

File tree

1 file changed

+44
-50
lines changed

1 file changed

+44
-50
lines changed

docs/content/docs/7.advanced/7.llms.md

Lines changed: 44 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,20 @@ description: Learn how to generate AI-ready content files using Nuxt Content and
44
the Nuxt LLMs module.
55
---
66

7-
# LLMs Integration
7+
The Nuxt Content module integrates [`nuxt-llms`](https://github.com/nuxtlabs/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](https://content.nuxt.com/docs/collections/types#page-type) to the LLMs module.🚀
88

9-
The Nuxt Content module seamlessly integrates with [`nuxt-llms`](https://github.com/nuxtlabs/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 `page` collection to the LLMs module.
9+
## Setup
1010

11-
## Setup Guide
11+
::prose-steps
12+
### Install the required module
1213

13-
1. First, install the required module:
14-
15-
```bash
14+
```bash [terminal]
1615
npm install nuxt-llms
17-
# or
18-
yarn add nuxt-llms
1916
```
2017

21-
2. Configure your `nuxt.config.ts`:
18+
### Configure your `nuxt.config.ts`
2219

23-
```ts
24-
// nuxt.config.ts
20+
```ts [nuxt.config.ts]
2521
export default defineNuxtConfig({
2622
modules: ['@nuxt/content', 'nuxt-llms'],
2723
llms: {
@@ -31,72 +27,70 @@ export default defineNuxtConfig({
3127
},
3228
})
3329
```
30+
::
3431

35-
That's it!
32+
That's it 🚀 `/llms.txt` file is automatically generated and pre-rendered.
3633

37-
Nuxt Content will automatically detect Nuxt LLMs module and will create a section to each `page` collection.
34+
## Sections
3835

39-
## Custom Sections
36+
When generating content, you can create custom sections to process your content into LLM-friendly formats.
4037

41-
The Content module enhances the LLMs module by adding two key options to control content generation:
38+
You can create custom sections to the `llms.sections` array and define the `contentCollection` and `contentFilters` option for each section.
4239

43-
- `contentCollection`: Specifies which content collection to use as source
44-
- `contentFilters`: Defines filters to select specific content within the collection
40+
::prose-warning
41+
If there is no section defined in the `contentCollection` option, the module will only add [page](https://content.nuxt.com/docs/collections/types#page-type) collections to the LLMs module.
42+
::
4543

46-
When generating content, the module uses these options to fetch and process your content into LLM-friendly formats (`llms.txt` and `llms_full.txt`).
44+
### `contentCollection`
4745

48-
All you need is to add your custom sections to the `llms.sections` array and define the `contentCollection` and `contentFilters` for each section.
46+
This option specifies which content collection to use as source.
4947

50-
```ts
51-
// nuxt.config.ts
48+
```ts [nuxt.config.ts]
5249
export default defineNuxtConfig({
53-
modules: ['@nuxt/content', 'nuxt-llms'],
5450
llms: {
55-
domain: 'https://your-site.com',
56-
title: 'Your Site Name',
57-
description: 'A brief description of your site',
5851
sections: [
5952
{
6053
title: 'Documentation',
6154
description: 'Technical documentation and guides',
62-
// Specify which content collection to use
6355
contentCollection: 'docs',
64-
// Filter content as needed
65-
contentFilters: [
66-
{ field: 'extension', operator: '=', value: 'md' },
67-
// You can add more filters here
68-
]
69-
},
56+
},
7057
],
7158
},
7259
})
7360
```
7461

75-
::note
76-
If there is no section defined with the `contentCollection` option, the module will add `page` collections to the LLMs module.
77-
::
62+
### `contentFilters`
7863

79-
### Content Filtering
64+
This options defines filters to select specific content within the collection.
8065

81-
You can use `contentFilters` to precisely control which content is included. Each filter consists of:
66+
You precisely control which content is included. Each filter consists of:
8267

8368
- `field`: The content property to check
8469
- `operator`: Comparison operator (`=`, `<>`, `>`, `<`, `LIKE`, `IN`, `NOT IN`, `IS NULL`, `IS NOT NULL`, etc.)
8570
- `value`: The value to compare against
8671

87-
Example filters:
88-
89-
```ts
90-
contentFilters: [
91-
// Only include markdown files
92-
{ field: 'extension', operator: '=', value: 'md' },
93-
// Only include published content
94-
{ field: 'draft', operator: '<>', value: true },
95-
// Filter by directory
96-
{ field: 'path', operator: 'LIKE', value: '/guide%' },
97-
]
72+
```ts [nuxt.config.ts]
73+
export default defineNuxtConfig({
74+
llms: {
75+
sections: [
76+
{
77+
title: 'Documentation',
78+
description: 'Technical documentation and guides',
79+
contentCollection: 'docs',
80+
contentFilters: [
81+
// Only include markdown files
82+
{ field: 'extension', operator: '=', value: 'md' },
83+
// Only include published content
84+
{ field: 'draft', operator: '<>', value: true },
85+
// Filter by directory
86+
{ field: 'path', operator: 'LIKE', value: '/guide%' },
87+
]
88+
},
89+
],
90+
},
91+
})
9892
```
9993

100-
::tip
101-
Checkout the [nuxt-llms documentation](https://github.com/nuxtlabs/nuxt-llms) for more information on how to use the LLMs module.
94+
::tip{to="https://github.com/nuxtlabs/nuxt-llms"}
95+
Checkout the nuxt-llms documentation for more information about the module.
10296
::

0 commit comments

Comments
 (0)