# Copy page

Hand any documentation page to an LLM as Markdown, a ready-made prompt, or a link.

Source: https://bugstars-docs.pages.dev/copy-page/

---

Readers increasingly finish a page by pasting it into a chat. The menu beside each title — the one at the top right of this page — gives them the page in the shape they need.

## What the menu does

| Item | Effect |
| --- | --- |
| Copy as Markdown | The page's Markdown, with its title, description and source URL on top |
| Copy for LLM prompt | The same Markdown, prefixed with an instruction and the page's source URL |
| Copy link | The page's URL |
| Open Markdown | Opens the `.md` file itself |
| Print page | Opens the browser's print dialog against the [print layout](/print-and-pdf/) |

The last two sit below a divider because they act on the page rather than the clipboard. Print is there because the print layout is otherwise undiscoverable — nothing else on a documentation page hints that one exists.

## The Markdown twin

Every documentation page is also served as Markdown at the same path with a `.md` extension — this page is at [`/copy-page.md`](/copy-page.md). The route is `src/pages/[...slug].md.ts`, and it is a first-class part of the site: linkable, crawlable, and useful to anything that would rather read Markdown than HTML.

<Alert variant="note" title="It is the source, not a rendering" text="The `.md` file is the page's own MDX, so component tags like `<Alert … />` appear verbatim. That is deliberate — a converter would have to know every component in the library, and the one it didn't know would silently ship a shorter page than the reader sees."/>

A static host decides whether a `.md` file opens in the browser or downloads. The dev server serves it as plain text; if your host downloads it instead, map the extension to `text/plain` there.

[`/llms.txt`](/llms.txt) indexes the twins: the site name and description, then every sidebar page in sidebar order, each linking to its `.md` file. It is generated from the docs collection by `src/pages/llms.txt.ts`, so a new page is listed as soon as it has a `group`, and a page with `noindex: true` is left out.

## Turning it on and off

Site-wide, in `src/data/pageTools.json`:

<CodeBlock language="json" filename="src/data/pageTools.json" showCopy={true}>

```
{
  "copyPage": {
    "enabled": true,
    "label": "Copy page"
  }
}
```

</CodeBlock>

Per page, in frontmatter — the same switch as `showFeedback` and `showPager`:

<CodeBlock language="mdx" filename="src/content/docs/internal-runbook.mdx" showCopy={true}>

```
---
title: Internal runbook
showCopyPage: false
---
```

</CodeBlock>

The `.md` twin is still built for a page with the menu switched off. Remove the route if you want no Markdown copies of the site at all.

## No JavaScript, no button

Every item needs the clipboard or a `fetch`, so the control ships `hidden` and reveals itself once its script runs — the same bargain as [the print button](/print-and-pdf/#print-this-page). A reader with JavaScript off sees nothing rather than a dead control, and the Markdown is still one URL away.
