This is the abridged developer documentation for starlight-llms-txt
# Configuration
> How to customize the llms.txt and llms-full.txt files generated by the starlight-llms-txt plugin
The `starlight-llms-txt` plugin can be configured in your Astro config file: astro.config.mjs ```js 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: llms.txt ```md # 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](https://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](https://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](https://github.com/micromatch/micromatch#matching-features). ```js 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](https://github.com/micromatch/micromatch#matching-features). The default value promotes the index page. If you’d like to promote more or other pages, add them to the array: ```ts // Example: In addition to the index page, also promote `getting-started` // and any pages in the root directory to the top of the output promote: ['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](https://github.com/micromatch/micromatch#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](https://github.com/micromatch/micromatch#matching-features). In the following example, a specific, outdated page is excluded as well as all pages in the `src/content/docs/tutorial/` directory: ```ts 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`](#minifycustomselectors) 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: ```ts 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](https://github.com/syntax-tree/hast-util-select#support) and should match your site’s HTML output. In the following example, `customSelectors` is used to exclude an `` custom element and an element showing a project’s sponsors that has the `sponsors-banner` class name: ```ts 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 `` 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. ```ts pageSeparator: '\n----------\n', ```
# Getting Started
> How to install and set-up starlight-llms-txt in your Starlight docs site
`starlight-llms-txt` is a plugin for the [Starlight](https://starlight.astro.build/) documentation website framework that auto-generates `llms.txt`, `llms-full.txt`, and `llms-small.txt` context files for large language models based on your documentation site’s content. You can learn more about `llms.txt` files at [llmstxt.org](https://llmstxt.org/). ## Prerequisites You will need to have a Starlight website set up. If you don’t have one yet, you can follow the [“Getting Started”](https://starlight.astro.build/getting-started) guide in the Starlight docs to create one. ## Installation 1. `starlight-llms-txt` is a Starlight [plugin](https://starlight.astro.build/reference/plugins/). Install it by running the following command in your terminal: * npm ```sh npm i starlight-llms-txt ``` * pnpm ```sh pnpm add starlight-llms-txt ``` * yarn ```sh yarn add starlight-llms-txt ``` 2. Configure the plugin in your Starlight [configuration](https://starlight.astro.build/reference/configuration/#plugins) in the `astro.config.mjs` file. A `site` URL is also required if you haven’t already set this: astro.config.mjs ```js 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()], }), ], }) ``` 3. [Start the development server](https://starlight.astro.build/getting-started/#start-the-development-server): * npm ```sh npm run dev ``` * pnpm ```sh pnpm run dev ``` * yarn ```sh yarn run dev ``` 4. Visit [`localhost:4321/llms.txt`](http://localhost:4321/llms.txt) to preview the plugin in action. ## Next steps See the [Configuration](/starlight-llms-txt/configuration/) guide to learn how to adjust the output of the plugin.