@writechoice/docusaurus-theme-llms-txt
v0.1.7
Published
Docusaurus theme that adds a Copy page toolbar button to every doc page for LLM tools
Readme
@writechoice/docusaurus-theme-llms-txt
Docusaurus theme that adds a Copy page toolbar button to every doc page, giving users one-click access to LLM tools.

Features
- Copy page — fetches the
.mdendpoint and copies the Markdown content to clipboard - View as Markdown — opens the raw
.mdfile in a new tab - Open in ChatGPT — opens
chatgpt.comwith the current page URL pre-filled - Open in Claude — opens
claude.ai/newwith the current page URL pre-filled - Responsive — floats right on desktop, drops below the title on mobile
- Light and dark mode support
Installation
npm install @writechoice/docusaurus-theme-llms-txtUsage
1. Add the theme to docusaurus.config.js
export default {
themes: ['@writechoice/docusaurus-theme-llms-txt'],
};2. Create a one-file swizzle in your project
Docusaurus requires theme wrappers that use @theme-original to live in your project's src/theme/ directory. Create this file:
src/theme/DocItem/Content/index.js
import React from 'react';
import OriginalContent from '@theme-original/DocItem/Content';
import LLMSToolbar from '@theme/LLMSToolbar';
export default function DocItemContent(props) {
return (
<>
<div style={{ float: 'right', marginLeft: '1rem', marginBottom: '0.25rem' }}>
<LLMSToolbar />
</div>
<OriginalContent {...props} />
</>
);
}That's the complete setup. The inline style avoids needing a separate CSS file.
Using the toolbar component directly
You can import LLMSToolbar anywhere in your theme:
import LLMSToolbar from '@theme/LLMSToolbar';
export default function MyLayout(props) {
return (
<>
<LLMSToolbar />
{/* ... */}
</>
);
}The component reads the current page URL from useLocation() and constructs the .md URL automatically — no props required.
Compatibility
| Docusaurus | Node | React | |---|---|---| | >= 3.0.0 | >= 18 | >= 18 |
Required: companion plugin
This theme provides the UI, but the toolbar's Copy page and View as Markdown features depend on .md files being available at /{path}.md. Those files are generated at build time by the companion plugin — without it, the copy button will fail to fetch content.
Install and configure both together:
npm install @writechoice/docusaurus-plugin-llms-txt @writechoice/docusaurus-theme-llms-txt// docusaurus.config.js
export default {
plugins: ['@writechoice/docusaurus-plugin-llms-txt'],
themes: ['@writechoice/docusaurus-theme-llms-txt'],
};See @writechoice/docusaurus-plugin-llms-txt for all plugin options including llms.txt customization and Cloudflare Pages support.
License
MIT
