Configuration
The starlight-llms-txt
plugin can be configured in your Astro config file:
import starlight from '@astrojs/starlight';import { defineConfig } from 'astro/config';import starlightLlmsTxt from 'starlight-llms-txt';
export default defineConfig({ site: 'https://example.com/', integrations: [ starlight({ title: 'My Docs', plugins: [ starlightLlmsTxt({ projectName: 'Very Cool Tool', }), ], }), ],});
Options
The following configuration options are available to pass to the plugin:
projectName
Type: string
Default: the value of Starlight’s title
option
Provide a custom name for this project or software.
This will be used in llms.txt
to identify what the documentation is for.
For example, with projectName: "FastHTML"
, the generated llms.txt
file would start:
# FastHTML
## Documentation Sets
- [Complete documentation](https://example.com/llms-full.txt): the full documentation for FastHTML
description
Type: string
Default: the value of Starlight’s description
option
Set a custom description for your documentation site to share with large language models.
Can include Markdown syntax.
Will be displayed as a blockquote in llms.txt
immediately after the file’s title.
According to llmstxt.org this should be:
a short summary of the project, containing key information necessary for understanding the rest of the file
details
Type: string
Default: undefined
Provide additional details to add after the description
in llms.txt
.
According to llmstxt.org this should be:
Zero or more markdown sections (e.g. paragraphs, lists, etc) of any type except headings, containing more detailed information about the project and how to interpret the provided files
optionalLinks
Type: Array<{ label: string; url: string; description?: string }>
Default: []
An array of optional links to add to the llms.txt
entrypoint.
URLs provided here can be skipped by the LLM if a shorter context is needed. Use it for secondary information which is not already in your docs content.
customSets
Type: Array<{ label: string; paths: string[]; description?: string; }>
Default: []
Specify additional subsets of your docs pages to generate and link to from llms.txt
.
This can be helpful for large docs sites where you need to break up your content into categories, so that LLMs can choose what data to ingest.
Each custom set should define a label and an array of page slugs or glob patterns that match page slugs to include.
Glob patterns are processed using micromatch
’s matching features.
customSets: [ { label: 'Reference', description: 'full reference documentation for my project', paths: ['reference/**'], }, { label: 'Tutorial', description: 'step-by-step tutorial for how to build a new project', paths: ['tutorial/**'], },];
promote
Type: string[]
Default: ['index*']
Use the promote
option to specify pages that should be sorted to the top of the llms-full.txt
and llms-small.txt
files.
The value should be an array of page slugs or glob patterns that match page slugs.
Glob patterns are processed using micromatch
’s matching features.
The default value promotes the index page. If you’d like to promote more or other pages, add them to the array:
// Example: In addition to the index page, also promote `getting-started`// and any pages in the root directory to the top of the outputpromote: ['index*', 'getting-started*', '!*/*'],
demote
Type: string[]
Default: []
Use the demote
option to specify pages that should be sorted to the bottom of the llms-full.txt
and llms-small.txt
files.
The value should be an array of page slugs or glob patterns that match page slugs.
Glob patterns are processed using micromatch
’s matching features.
If a page matches patterns in both promote
and demote
, it will be demoted.
exclude
Type: string[]
Default: []
Use the exclude
option to specify docs pages that should be excluded when generating llms-small.txt
.
This allows you to filter out non-essential documentation for models with a smaller context window.
The value of exclude
is an array of page slugs or glob patterns that match page slugs.
Glob patterns are processed using micromatch
’s matching features.
In the following example, a specific, outdated page is excluded as well as all pages in the src/content/docs/tutorial/
directory:
exclude: ['old-page', 'tutorial/**'],
minify
A map of content types to filter out of docs when creating llms-small.txt
for small context windows.
Set an element to true
to filter it out or to false
to keep it.
Use the customSelectors
option to provide an array of additional CSS-style selectors that match elements to exclude.
In the following example, the default exclusion of notes is overridden and a custom in-page navigation component is added to the elements to exclude:
minify: { note: false, customSelectors: ['.my-page-nav'],},
minify.customSelectors
Type: string[]
Default: []
Specify custom CSS-style selectors to exclude.
Selectors are tested with hast-util-select
’s matching features and should match your site’s HTML output.
In the following example, customSelectors
is used to exclude an <interactive-demo>
custom element and an element showing a project’s sponsors that has the sponsors-banner
class name:
customSelectors: ['interactive-demo', '.sponsors-banner'],
minify.note
Type: boolean
Default: true
Exclude the note
variant of Starlight’s aside component.
minify.tip
Type: boolean
Default: true
Exclude the tip
variant of Starlight’s aside component.
minify.caution
Type: boolean
Default: false
Exclude the caution
variant of Starlight’s aside component.
minify.danger
Type: boolean
Default: false
Exclude the danger
variant of Starlight’s aside component.
minify.details
Type: boolean
Default: true
Exclude the <details>
HTML element.
minify.whitespace
Type: boolean
Default: true
Collapse whitespace.
When minify.whitespace
is set to true
, all whitespace — including new lines — is collapsed to a single space character.
pageSeparator
Type: string
Default: "\n\n"
The separator used when concatenating page entries together.
pageSeparator: '\n----------\n',