Generate the llms.txt file
Starlight Page Actions can automatically generate the llms.txt file for your documentation site.
This file lists all the pages in your documentation with their section headings, titles, and URLs.
Enabling llms.txt generation
Section titled “Enabling llms.txt generation”To generate the llms.txt file, you must specify the baseUrl option in the plugin configuration. Without it, the file will not be created.
import starlight from "@astrojs/starlight";import { defineConfig } from "astro/config";import starlightPageActions from "starlight-page-actions";
export default defineConfig({ integrations: [ starlight({ plugins: [ starlightPageActions({ baseUrl: "https://mydocs.example.com/", }), ], title: "My Docs", }), ],});Viewing the llms.txt file
Section titled “Viewing the llms.txt file”-
Run a build for your Starlight project.
Terminal window npm run buildTerminal window yarn buildTerminal window pnpm build -
Start the preview server.
Terminal window npm run previewTerminal window yarn previewTerminal window pnpm preview -
Open http://localhost:4321/llms.txt in your browser to see the generated file.