Skip to content

Getting Started

You need an existing Starlight project. If you don’t have one yet, follow the Starlight Getting Started guide to create one.

Install the plugin using your preferred package manager:

Terminal window
npm install starlight-page-context-action

Add the plugin to your Starlight configuration in astro.config.mjs:

import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightPageContextAction from "starlight-page-context-action";
export default defineConfig({
integrations: [
starlight({
title: "My Docs",
plugins: [starlightPageContextAction()],
}),
],
});

That’s it! The plugin will automatically:

  1. Add a “Copy page” button that copies the raw markdown of the current page
  2. Add an “Open in Chat” dropdown with links to ChatGPT, Claude, and T3 Chat
  3. Add a “Scroll to top” button that smoothly scrolls back to the top of the page
  4. Place all actions in the right sidebar above the table of contents
  5. Add a mobile “Page Actions” dropdown next to the mobile table of contents toggle

Start your dev server and look at the right sidebar. You should see a “Page Actions” section above the table of contents with the copy and AI buttons.

On mobile, resize your browser or use a mobile device — you should see a “Page Actions” toggle in the mobile bar alongside the “On this page” table of contents toggle.

Terminal window
npm run dev
  • Configure which actions to show and customize the AI prompt.
  • See examples of different configurations.