---
title: "Page Actions"
description: "Add \"Open in LLM\" and \"Copy Markdown\" buttons to your doc pages"
canonical_url: "https://docs.farming-labs.dev/docs/customization/page-actions"
markdown_url: "https://docs.farming-labs.dev/docs/customization/page-actions.md"
last_updated: "2018-10-20"
agent:
  tokenBudget: 900
  task: "Configure Copy Markdown and Open in LLM actions for docs pages."
  outcome: "The selected actions appear in the intended position and produce canonical Markdown or provider URLs for the current page."
  appliesTo:
    framework:
      - "nextjs"
      - "tanstackstart"
      - "sveltekit"
      - "astro"
      - "nuxt"
    version:
      - ">=0.2.60"
    package:
      - "@farming-labs/docs"
  prerequisites:
    - "Machine-readable Markdown routes work for the docs entry."
    - "Configure github.url before using provider templates that require a GitHub source URL."
  files:
    - "docs.config.ts"
    - "docs.config.tsx"
    - "src/lib/docs.config.ts"
  sideEffects:
    - "Open in LLM can navigate users to an external provider with the configured prompt and page URL."
    - "Custom copy callbacks can emit analytics for copied documentation content."
  verification:
    - description: "Open a docs page, copy Markdown, and exercise each configured external provider action."
      expect: "Copied text matches the configured format and every provider URL contains the canonical current-page target."
  rollback:
    - "Disable pageActions or restore the previous provider, alignment, and copy settings."
  failureModes:
    - symptom: "Copy Markdown returns HTML or an empty response."
      resolution: "Verify the page .md route and shared docs API Markdown format before changing the button."
    - symptom: "A provider opens with an unresolved template token."
      resolution: "Use only documented URL template variables and configure github.url when githubUrl is required."
---

<!-- farming-labs:agent-contract:start -->
## Agent Contract

Task: Configure Copy Markdown and Open in LLM actions for docs pages.
Outcome: The selected actions appear in the intended position and produce canonical Markdown or provider URLs for the current page.

### Applies To

- Framework: `nextjs`, `tanstackstart`, `sveltekit`, `astro`, `nuxt`
- Version: `>=0.2.60`
- Package: `@farming-labs/docs`

### Prerequisites

- Machine-readable Markdown routes work for the docs entry.
- Configure github.url before using provider templates that require a GitHub source URL.

### Files

- `docs.config.ts`
- `docs.config.tsx`
- `src/lib/docs.config.ts`

### Side Effects

- Open in LLM can navigate users to an external provider with the configured prompt and page URL.
- Custom copy callbacks can emit analytics for copied documentation content.

### Verification

- Open a docs page, copy Markdown, and exercise each configured external provider action.
  - Expected: Copied text matches the configured format and every provider URL contains the canonical current-page target.

### Rollback

- Disable pageActions or restore the previous provider, alignment, and copy settings.

### Failure Modes

- Copy Markdown returns HTML or an empty response. — Recovery: Verify the page .md route and shared docs API Markdown format before changing the button.
- A provider opens with an unresolved template token. — Recovery: Use only documented URL template variables and configure github.url when githubUrl is required.
<!-- farming-labs:agent-contract:end -->

# Page Actions

## Page Actions task

Task: Configure Copy Markdown and Open in LLM actions for docs pages.

Expected result: The selected actions appear in the intended position and produce canonical Markdown or provider URLs for the current page.

## Page Actions prerequisites

- Machine-readable Markdown routes work for the docs entry.
- Configure github.url before using provider templates that require a GitHub source URL.
- Applies to framework nextjs, tanstackstart, sveltekit, astro, nuxt; version >=0.2.60; package @farming-labs/docs.

## Page Actions verification

- Open a docs page, copy Markdown, and exercise each configured external provider action. Expected: Copied text matches the configured format and every provider URL contains the canonical current-page target.
- Failure: Copy Markdown returns HTML or an empty response.
- Recovery: Verify the page .md route and shared docs API Markdown format before changing the button.
- Rollback: Disable pageActions or restore the previous provider, alignment, and copy settings.

## Page Actions agent guidance

Edit top-level `pageActions` in `docs.config.ts` or `docs.config.tsx`. Enable
`copyMarkdown` for clipboard output and `openDocs` for provider links; prefer
`openDocs.target: "markdown"` so the prompt receives the current machine-readable page. Configure
top-level `github` before using the `github` target or `{githubUrl}` template value.

First verify the page's `.md` route, then copy Markdown and open every configured provider from that
page. If copying returns HTML or an empty body, repair the Markdown route rather than the button. If
a provider URL contains an unresolved token, use only the documented template placeholders and
check the required `github.url`. To remove both actions, delete `pageActions` or set both
`copyMarkdown: false` and `openDocs: false`.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
