Customize the Prompt
Starlight Page Actions includes a default prompt that is automatically applied when a user opens the documentation in an AI tool like ChatGPT. This default prompt looks like this:
Read {url}. I want to ask questions about it.You can override this behavior by providing your own custom prompt.
How to customize the prompt
Section titled “How to customize the prompt”Use the prompt option inside the plugin configuration:
import starlight from "@astrojs/starlight";import { defineConfig } from "astro/config";import starlightPageActions from "starlight-page-actions";
export default defineConfig({ integrations: [ starlight({ plugins: [ starlightPageActions({ prompt: "Read {url} and explain its main points briefly.", }), ], title: "My Docs", }), ],});Using {url} in your prompt
Section titled “Using {url} in your prompt”You can reference the current page URL in your custom prompt by including {url}.
For example:
You are a technical assistant. Read {url} and summarize the most important concepts.The {url} placeholder will automatically be replaced at runtime.
If you do not include {url} in your prompt, the page URL will be automatically appended at the end.
Internationalization
Section titled “Internationalization”The prompt can be internationalized. See the Internationalization guide for more details.
import { defineConfig } from "astro/config";import starlight from "@astrojs/starlight";import starlightPageActions from "starlight-page-actions";
export default defineConfig({ integrations: [ starlight({ locales: { root: { label: "English", lang: "en", }, es: { label: "Español", lang: "es", }, }, plugins: [ starlightPageActions({ prompt: "Read {url} and explain its main points briefly.", locales: { es: { prompt: "Lee {url} y explica brevemente sus puntos principales.", }, }, }), ], title: "My Docs", }), ],});