# Page Actions
URL: /docs/customization/page-actions
LLM index: /llms.txt
Description: Add "Open in LLM" and "Copy Markdown" buttons to your doc pages

# Page Actions

Use this page when the user asks about this topic: Add "Open in LLM" and "Copy Markdown" buttons to your doc pages.
Keep answers grounded in the exact options, routes, commands, and examples documented here.
If the request moves beyond this page, point to the closest related docs instead of inventing config.

Page actions are buttons rendered above or below the page title. They let users interact with page content — copy it as Markdown, or open it in an LLM provider like ChatGPT or Claude.

## Quick Start

```ts title="docs.config.ts"
pageActions: {
  copyMarkdown: { enabled: true },
  openDocs: { enabled: true },
}
```

This adds two buttons: **Copy Markdown** and an **Open in...** dropdown.

## Configuration Reference

All options go inside the `pageActions` object in `docs.config.ts`:

```ts title="docs.config.ts"
export default defineDocs({
  pageActions: {
    // ... options
  },
});
```

---

## `pageActions.position`

Where to render the page action buttons relative to the page title.

| Type                             | Default         |
| -------------------------------- | --------------- |
| `"above-title" \| "below-title"` | `"below-title"` |

```ts
pageActions: {
  position: "above-title",
}
```

<Callout type="info" title="Reading time follows this slot">
  If reading time is active for the current page, the read-time label stays attached to the same
  title-area slot. `above-title` places it directly under the action row. `below-title` keeps it
  grouped in the below-title metadata area. This also applies when a page opts in with frontmatter
  like `readingTime: true` or `readingTime: 8`.
</Callout>

---

## `pageActions.alignment`

Control whether the action row is left- or right-aligned.

| Type                  | Default  |
| --------------------- | -------- |
| `"left" \| "right"` | `"left"` |

```ts title="docs.config.ts"
pageActions: {
  alignment: "right",
}
```

---

## Copy Markdown

### `pageActions.copyMarkdown`

Whether to show the "Copy Markdown" button. Copies the current page's content as Markdown to the clipboard.

| Type                              | Default |
| --------------------------------- | ------- |
| `boolean \| { enabled: boolean }` | `false` |

```ts
pageActions: {
  copyMarkdown: true,
  // or
  copyMarkdown: { enabled: true },
}
```

---

## Open in LLM

The **Open in...** dropdown lets users send the current page to an LLM or tool. Built-in providers can target the public `.md` route, the rendered page, the source `.mdx` URL, or the GitHub edit URL.

### `pageActions.openDocs`

Enable the "Open in..." dropdown. Can be a boolean or an object with additional configuration.

| Type                        | Default |
| --------------------------- | ------- |
| `boolean \| OpenDocsConfig` | `false` |

```ts
pageActions: {
  openDocs: true,
}
```

When set to `true`, the built-in provider list is used: **ChatGPT** and **Claude**.

### `pageActions.openDocs.enabled`

Whether to show the "Open in..." dropdown.

| Type      | Default |
| --------- | ------- |
| `boolean` | `false` |

### `pageActions.openDocs.providers`

Custom list of LLM / tool providers to show in the dropdown. Use provider strings for the built-in presets, or objects when you need icons, labels, per-provider prompts, or a custom URL template.

| Type                 | Default           |
| -------------------- | ----------------- |
| `OpenDocsProvider[]` | Built-in defaults |

```ts title="docs.config.ts"
pageActions: {
  openDocs: {
    enabled: true,
    target: "markdown",
    providers: ["chatgpt", "claude", "cursor"],
  },
}
```

Built-in provider ids are `"chatgpt"`, `"claude"`, `"cursor"`, `"gemini"`, `"copilot"`, and `"github"`.

### `pageActions.openDocs.target`

Controls which URL is inserted into `{url}` for the built-in provider prompt.

| Value        | Used for                                                        |
| ------------ | --------------------------------------------------------------- |
| `"markdown"` | Public `.md` route for the page. This is the default.           |
| `"page"`     | Rendered docs page URL.                                         |
| `"source"`   | Source-style `.mdx` URL.                                        |
| `"github"`   | GitHub edit URL, when the top-level `github` config is present. |

### `pageActions.openDocs.prompt`

Prompt text sent to built-in providers. It defaults to:

```ts
"Read this documentation: {url}"
```

You can make the handoff more specific:

```ts title="docs.config.ts"
pageActions: {
  openDocs: {
    enabled: true,
    target: "markdown",
    prompt: "Use this documentation while editing the codebase: {url}",
    providers: ["chatgpt", "claude", { id: "cursor", mode: "app" }],
  },
}
```

<Callout type="info" title="Agent-ready docs links">
  `target: "markdown"` sends providers to the public `.md` route for the current page. That route can
  return a sibling `agent.md` when the page has one. In Next.js, HTTP clients can also request the
  normal page URL with `Accept: text/markdown`, or send `Signature-Agent` when they identify
  themselves as an agent. See [Agent Primitive](/docs/customization/agent-primitive).
</Callout>

### Provider Objects

Provider objects can customize a preset while keeping its built-in URL:

```tsx title="docs.config.tsx"
import { SiClaude, SiOpenai } from "react-icons/si";

pageActions: {
  openDocs: {
    enabled: true,
    target: "markdown",
    providers: [
      { id: "chatgpt", name: "ChatGPT", icon: <SiOpenai className="size-4" /> },
      { id: "claude", name: "Claude", icon: <SiClaude className="size-4" /> },
      {
        id: "cursor",
        mode: "app",
        prompt: "Open this docs page in Cursor context: {url}",
      },
    ],
  },
}
```

### Custom URL Templates

Use `urlTemplate` when you need a provider that is not built in. This keeps the previous API working.

```ts title="docs.config.ts"
pageActions: {
  openDocs: {
    enabled: true,
    providers: [
      {
        name: "Internal AI",
        urlTemplate: "https://internal.example/new?prompt={prompt}",
        prompt: "Read this documentation: {markdownUrl}",
      },
    ],
  },
}
```

The `urlTemplate` string supports these placeholders:

| Placeholder     | Replaced with                                                                 |
| --------------- | ----------------------------------------------------------------------------- |
| `{prompt}`      | The resolved prompt text                                                       |
| `{url}`         | The selected target URL, controlled by `target`                                |
| `{pageUrl}`     | The rendered docs page URL                                                     |
| `{markdownUrl}` | The public `.md` route for the page                                            |
| `{sourceUrl}`   | The source-style `.mdx` URL for the page                                       |
| `{mdxUrl}`      | Alias for `{sourceUrl}`                                                        |
| `{githubUrl}` | GitHub **edit** URL for the current page (same as "Edit on GitHub"). Requires `github` in config. Use `urlTemplate: "{githubUrl}"` so "Open in GitHub" opens the file on GitHub. |

<Callout type="info" title="Legacy URL templates still work">
  Existing providers that use `name` and `urlTemplate` are still supported. For custom URL
  templates, `{url}` keeps the previous page-URL behavior unless you explicitly set `target`.
  New configs should prefer `target: "markdown"` with provider strings.
</Callout>

## Full Example

```ts title="docs.config.ts"
export default defineDocs({
  pageActions: {
    position: "below-title",
    copyMarkdown: { enabled: true },
    openDocs: {
      enabled: true,
      target: "markdown",
      prompt: "Read this documentation: {url}",
      providers: ["chatgpt", "claude", "cursor"],
    },
  },
});
```