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,});actions
Section titled “actions”An object controlling which action buttons are displayed.
| Key | Type | Default | Description |
|---|---|---|---|
copy | boolean | true | Show the “Copy page” button. |
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.
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, actions: { copy: true, // default chatgpt: true, // default claude: true, // default t3chat: true, // default scrollTop: true, // default }, }), ], }), ],});