Configuration
All configuration options are optional. The plugin works with zero configuration out of the box.
Options
Section titled “Options”prompt
Section titled “prompt”Type: string
Default: "Read {url}. I want to ask questions about it."
The prompt template sent to AI chat services. The {url} placeholder is replaced with the current page’s URL at runtime.
starlightPageContextAction({ prompt: "Summarize {url} and help me understand the key concepts.",});position
Section titled “position”Type: "above-toc" | "below-toc"
Default: "above-toc"
Controls where the page action buttons are rendered in the right sidebar relative to the table of contents.
starlightPageContextAction({ position: "below-toc",});layout
Section titled “layout”Type: "spread" | "compact"
Default: "spread"
Controls the visual layout of the action buttons.
"spread"— Buttons are displayed vertically in a list (default)."compact"— A primary “Copy page” pill button is shown inline with a kebab (⋮) menu containing all actions.
starlightPageContextAction({ layout: "compact",});sticky
Section titled “sticky”Type: boolean
Default: false
Whether the action wrapper sticks to the top of the sidebar on scroll. When position is "below-toc", the wrapper sticks to the bottom instead.
starlightPageContextAction({ sticky: true,});llmsTxt
Section titled “llmsTxt”Type: boolean
Default: false
When enabled, the plugin generates:
llms.txtwith links to cleaned Markdown docs pagesllms-full.txtwith concatenated cleaned Markdown page content
starlightPageContextAction({ llmsTxt: true,});This is useful for making your docs easier to consume in LLM tooling that supports llms.txt discovery.
llms-full.txt follows the same page ordering as llms.txt, and each page body is separated by ---.
During local development, you can preview the generated content at /llms.txt and /llms-full.txt while running the Astro dev server.
actions
Section titled “actions”An object controlling which action buttons are displayed.
| Key | Type | Default | Description |
|---|---|---|---|
copy |
boolean |
true |
Show the “Copy page” button. |
viewMarkdown |
boolean |
false |
Show the “View as Markdown” action. |
chatgpt |
boolean |
true |
Show “Open in ChatGPT” in the dropdown. |
claude |
boolean |
true |
Show “Open in Claude” in the dropdown. |
t3chat |
boolean |
true |
Show “Open in T3 Chat” in the dropdown. |
scrollTop |
boolean |
true |
Show a “Scroll to top” button. |
starlightPageContextAction({ actions: { copy: true, chatgpt: true, claude: false, // Hide Claude option t3chat: false, // Hide T3 Chat option scrollTop: true, // Show scroll-to-top button },});Mobile Support
Section titled “Mobile Support”The plugin automatically adds a “Page Actions” dropdown to the mobile table of contents bar. On small screens, the actions appear as a compact toggle pill (styled identically to Starlight’s “On this page” toggle) that opens a dropdown with all enabled actions.
The mobile dropdown and the table of contents toggle are mutually exclusive — opening one automatically closes the other.
No additional configuration is needed. The same actions settings apply to both desktop and mobile views, and the pageContextActions: false frontmatter opt-out disables actions on both.
View as Markdown
Section titled “View as Markdown”The plugin can also add a “View as Markdown” action. This opens the cleaned Markdown file generated during the build in the browser, using the same transformed output that powers the copy action.
When enabled, it is useful for:
- Inspecting the cleaned Markdown directly in the browser
- Sharing a stable Markdown URL with AI tools or collaborators
- Verifying how MDX components were converted during the build
Enable it with actions.viewMarkdown: true.
Per-Page Opt-Out
Section titled “Per-Page Opt-Out”You can disable page actions on individual pages by setting pageContextActions: false in the page’s frontmatter:
---title: My Private PagepageContextActions: false---
This page will not show any page action buttons.This disables actions on both desktop (sidebar) and mobile (mobile bar). All other pages will continue to show actions as normal. See the disabled actions example for a live demo.
Full Example
Section titled “Full Example”Here’s the exact configuration used on this documentation site. It places the action buttons below the table of contents and makes them sticky, while relying on defaults for everything else:
import { defineConfig } from "astro/config";import starlight from "@astrojs/starlight";import starlightPageContextAction from "starlight-page-context-action";
export default defineConfig({ integrations: [ starlight({ title: "Starlight Page Context Action", plugins: [ starlightPageContextAction({ prompt: "Read {url}. I want to ask questions about it.", // default position: "below-toc", layout: "spread", // default sticky: true, llmsTxt: true, actions: { copy: true, // default viewMarkdown: true, chatgpt: true, // default claude: true, // default t3chat: true, // default scrollTop: true, // default }, }), ], }), ],});