Skip to content

Configuration

All configuration options are optional. The plugin works with zero configuration out of the box.

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.",
});

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",
});

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",
});

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,
});

An object controlling which action buttons are displayed.

KeyTypeDefaultDescription
copybooleantrueShow the “Copy page” button.
chatgptbooleantrueShow “Open in ChatGPT” in the dropdown.
claudebooleantrueShow “Open in Claude” in the dropdown.
t3chatbooleantrueShow “Open in T3 Chat” in the dropdown.
scrollTopbooleantrueShow 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
},
});

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.

You can disable page actions on individual pages by setting pageContextActions: false in the page’s frontmatter:

---
title: My Private Page
pageContextActions: 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.

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
},
}),
],
}),
],
});