Skip to content

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.

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",
}),
],
});
  1. Run a build for your Starlight project.

    Terminal window
    npm run build
  2. Start the preview server.

    Terminal window
    npm run preview
  3. Open http://localhost:4321/llms.txt in your browser to see the generated file.