Turns a Markdown docs folder in a Git repo into Payload-managed documentation sets and renders them in a Next.js site with payload-markdown. A separate native pmdocs CLI validates, plans and publishes docs, using GitHub Actions OIDC or Ed25519 signed pushes. It adds admin collections for sets, groups and access, and requires payload-markdown and the SEO plugin as peer dependencies.
Git-backed Markdown documentation sync for Payload CMS, powered by payload-markdown.
Installation
npm i @valkyrianlabs/payload-markdown-docs4
Stars
0
Forks
1
Open Issues
5 days ago
Last Updated
888
Weekly Downloads
v1.5.1
npm Version
1.3 MB
Unpacked Size
2
Dependencies
4+1 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 4 |
| Dec 4, 2026 | 4 |
| Dec 3, 2026 | 4 |
| Dec 2, 2026 | 4 |
| Dec 1, 2026 | 4 |
| Nov 30, 2026 | 4 |
| Nov 29, 2026 | 4 |
| Nov 28, 2026 | 4 |
| Nov 27, 2026 | 4 |
| Nov 26, 2026 | 4 |
| Nov 25, 2026 | 4 |
| Nov 24, 2026 | 4 |
| Nov 23, 2026 | 4 |
| Nov 22, 2026 | 4 |
| Nov 21, 2026 | 4 |
| Nov 20, 2026 | 4 |
| Nov 19, 2026 | 4 |
| Nov 18, 2026 | 4 |
| Nov 17, 2026 | 4 |
| Nov 16, 2026 | 4 |
| Nov 15, 2026 | 4 |
| Nov 14, 2026 | 4 |
| Nov 13, 2026 | 4 |
| Nov 12, 2026 | 4 |
| Nov 11, 2026 | 4 |
| Nov 10, 2026 | 4 |
| Nov 9, 2026 | 4 |
| Nov 8, 2026 | 4 |
| Nov 7, 2026 | 4 |
| Nov 6, 2026 | 4 |
| Nov 5, 2026 | 4 |
| Nov 4, 2026 | 4 |
| Nov 3, 2026 | 4 |
| Nov 2, 2026 | 4 |
| Nov 1, 2026 | 4 |
| Oct 31, 2026 | 4 |
| Oct 30, 2026 | 4 |
| Oct 29, 2026 | 4 |
| Oct 28, 2026 | 4 |
| Oct 27, 2026 | 4 |
| Oct 26, 2026 | 4 |
| Oct 25, 2026 | 4 |
| Oct 24, 2026 | 4 |
| Oct 23, 2026 | 4 |
| Oct 22, 2026 | 4 |
| Oct 21, 2026 | 4 |
| Oct 20, 2026 | 4 |
| Oct 19, 2026 | 4 |
| Oct 18, 2026 | 4 |
| Oct 17, 2026 | 4 |
| Oct 16, 2026 | 4 |
| Oct 15, 2026 | 4 |
| Oct 14, 2026 | 4 |
| Oct 13, 2026 | 4 |
| Oct 12, 2026 | 4 |
| Oct 11, 2026 | 4 |
| Oct 10, 2026 | 4 |
| Oct 9, 2026 | 4 |
| Oct 8, 2026 | 4 |
| Oct 7, 2026 | 4 |
| Oct 6, 2026 | 4 |
| Oct 5, 2026 | 4 |
| Oct 4, 2026 | 4 |
| Oct 3, 2026 | 4 |
| Oct 2, 2026 | 3 |
| Oct 1, 2026 | 3 |
| Sep 30, 2026 | 3 |
| Sep 29, 2026 | 3 |
| Sep 28, 2026 | 3 |
| Sep 27, 2026 | 3 |
| Sep 26, 2026 | 3 |
| Sep 25, 2026 | 3 |
| Sep 24, 2026 | 3 |
| Sep 23, 2026 | 3 |
| Sep 22, 2026 | 3 |
| Sep 21, 2026 | 3 |
| Sep 20, 2026 | 3 |
| Sep 19, 2026 | 3 |
| Sep 18, 2026 | 3 |
| Sep 17, 2026 | 3 |
| Sep 16, 2026 | 3 |
| Sep 15, 2026 | 3 |
| Sep 14, 2026 | 3 |
| Sep 13, 2026 | 3 |
| Sep 12, 2026 | 3 |
| Sep 11, 2026 | 3 |
| Sep 10, 2026 | 3 |
| Sep 9, 2026 | 3 |
| Sep 8, 2026 | 3 |
| Sep 7, 2026 | 3 |
| Sep 6, 2026 | 3 |
724+701 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 724 |
| Dec 4, 2026 | 708 |
| Dec 3, 2026 | 529 |
| Dec 2, 2026 | 432 |
| Dec 1, 2026 | 401 |
| Nov 30, 2026 | 75 |
| Nov 29, 2026 | 74 |
| Nov 28, 2026 | 76 |
| Nov 27, 2026 | 75 |
| Nov 26, 2026 | 73 |
| Nov 25, 2026 | 10 |
| Nov 24, 2026 | 10 |
| Nov 23, 2026 | 9 |
| Nov 22, 2026 | 16 |
| Nov 21, 2026 | 14 |
| Nov 20, 2026 | 20 |
| Nov 19, 2026 | 22 |
| Nov 18, 2026 | 83 |
| Nov 17, 2026 | 82 |
| Nov 16, 2026 | 85 |
| Nov 15, 2026 | 80 |
| Nov 14, 2026 | 80 |
| Nov 13, 2026 | 77 |
| Nov 12, 2026 | 77 |
| Nov 11, 2026 | 17 |
| Nov 10, 2026 | 20 |
| Nov 9, 2026 | 30 |
| Nov 8, 2026 | 30 |
| Nov 7, 2026 | 33 |
| Nov 6, 2026 | 36 |
| Nov 5, 2026 | 37 |
| Nov 4, 2026 | 38 |
| Nov 3, 2026 | 42 |
| Nov 2, 2026 | 31 |
| Nov 1, 2026 | 36 |
| Oct 31, 2026 | 36 |
| Oct 30, 2026 | 42 |
| Oct 29, 2026 | 38 |
| Oct 28, 2026 | 34 |
| Oct 27, 2026 | 174 |
| Oct 26, 2026 | 188 |
| Oct 25, 2026 | 373 |
| Oct 24, 2026 | 375 |
| Oct 23, 2026 | 362 |
| Oct 22, 2026 | 366 |
| Oct 21, 2026 | 374 |
| Oct 20, 2026 | 230 |
| Oct 19, 2026 | 216 |
| Oct 18, 2026 | 31 |
| Oct 17, 2026 | 31 |
| Oct 16, 2026 | 33 |
| Oct 15, 2026 | 29 |
| Oct 14, 2026 | 85 |
| Oct 13, 2026 | 93 |
| Oct 12, 2026 | 185 |
| Oct 11, 2026 | 373 |
| Oct 10, 2026 | 369 |
| Oct 9, 2026 | 367 |
| Oct 8, 2026 | 367 |
| Oct 7, 2026 | 304 |
| Oct 6, 2026 | 292 |
| Oct 5, 2026 | 198 |
| Oct 4, 2026 | 3 |
| Oct 3, 2026 | 19 |
| Oct 2, 2026 | 21 |
| Oct 1, 2026 | 21 |
| Sep 30, 2026 | 20 |
| Sep 29, 2026 | 20 |
| Sep 28, 2026 | 20 |
| Sep 27, 2026 | 20 |
| Sep 26, 2026 | 6 |
| Sep 25, 2026 | 6 |
| Sep 24, 2026 | 6 |
| Sep 23, 2026 | 6 |
| Sep 22, 2026 | 7 |
| Sep 21, 2026 | 70 |
| Sep 20, 2026 | 127 |
| Sep 19, 2026 | 126 |
| Sep 18, 2026 | 129 |
| Sep 17, 2026 | 129 |
| Sep 16, 2026 | 130 |
| Sep 15, 2026 | 129 |
| Sep 14, 2026 | 129 |
| Sep 13, 2026 | 134 |
| Sep 12, 2026 | 135 |
| Sep 11, 2026 | 135 |
| Sep 10, 2026 | 135 |
| Sep 9, 2026 | 134 |
| Sep 8, 2026 | 143 |
| Sep 7, 2026 | 81 |
| Sep 6, 2026 | 23 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1231094179-root)<a href="https://payloaddirectory.dev/plugins/1231094179-root"><img src="https://payloaddirectory.dev/badge/1231094179-root.svg" alt="Payload Directory"></a>README
payload-markdown-docs v1.0.0 release banner
AI-first Markdown documentation generation, sync, and publishing for Payload CMS.
payload-markdown-docs turns a repo-local /docs tree into
Payload-native documentation that can be generated with AI, reviewed as plain
Markdown, validated locally, synced through GitHub Actions, and rendered in your
Next/Payload site with payload-markdown.
It is the documentation delivery pipeline for teams who want docs to move as fast as the code they describe.
Install the Payload plugin package in the Payload app:
pnpm add payload-markdown-docs payload-markdown @payloadcms/plugin-seo
The two companion packages are peer dependencies; see Install.
The npm package is the Payload plugin/runtime integration only. It does not
install a supported CLI. Install the native pmdocs binary separately for docs
validation, planning, route installation, key generation, and publishing.
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://apt.valkyrianlabs.com/pubkey.gpg \
-o /etc/apt/keyrings/valkyrianlabs.gpg
sudo chmod 0644 /etc/apt/keyrings/valkyrianlabs.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/valkyrianlabs.gpg] https://apt.valkyrianlabs.com stable main" | \
sudo tee /etc/apt/sources.list.d/valkyrianlabs.list > /dev/null
sudo apt update
sudo apt install -y pmdocs
pmdocs --version
The packages recommend valkyrianlabs-archive-keyring (APT installs it by default), which puts the repository key at
/usr/share/keyrings/valkyrianlabs.gpg and keeps it current through normal upgrades (for example when its
expiry changes). When the key downloaded above is unmodified, the package replaces it with a symlink to the
packaged key, so the source line above keeps working and you never need to download the key again. Removing
the package turns the symlink back into a plain copy. Signing key fingerprint:
494D 71A1 EEDD F87B D48E 5048 6D64 CB7B DFC3 0EC6.
brew install valkyrianlabs/tap/pmdocs
pmdocs --version
Use the full name valkyrianlabs/tap/pmdocs. Homebrew taps
valkyrianlabs/tap if needed and trusts only the pmdocs formula, so there is
no separate brew tap or brew trust step. Afterwards brew upgrade (or
brew upgrade pmdocs) keeps it current.
Installed it earlier with brew tap valkyrianlabs/tap and
brew install pmdocs? Current Homebrew refuses to load formulae from a tap you
have not trusted, so brew upgrade skips pmdocs. Run
brew upgrade valkyrianlabs/tap/pmdocs once; the full name trusts it from then
on.
Alright, I already know what you're thinking:
"This guy doesn't respect Windows as an operating system."
And you would be correct.
Jokes aside: For v1, pmdocs targets macOS developer machines and Debian/Ubuntu Linux CI/server environments. Windows users should use WSL2 or a Linux CI runner.
The split is intentional: npm installs the Payload plugin/runtime package, and
the operating system installs the pmdocs operator CLI. That keeps Payload app
dependencies focused on runtime code while CI jobs, docs-only repos, local
machines, and release runners can validate and publish docs without a Node
dependency install.
The practical result is simpler operations. Install the plugin where Payload
runs. Install pmdocs where docs are authored, checked, signed, and pushed.
Homebrew and Debian packages give the CLI a predictable system path, native
dependencies, and the same workflow in CI as on a developer machine.
Native Windows packages are not a v1 target. Use WSL2 with the Debian install flow, or publish docs from Linux/macOS developer machines and CI runners.
Most documentation tools make you choose between three bad options:
payload-markdown-docs is built for a different workflow:
analyze codebase
-> generate docs with a repo-local AI skill
-> write plain Markdown into /docs
-> validate and plan the docs tree
-> sync through GitHub OIDC or Ed25519
-> render inside your Payload/Next site
The docs stay as plain Markdown files. The native CLI handles local validation, planning, signing, and upload. The Payload plugin owns server authority, route-aware metadata, syncing, publishing, and rendering.
AI gets the speed. Humans keep the control. Payload owns the output.
This plugin is designed around AI-assisted documentation from the ground up.
Install a native agent skill:
pmdocs install skill --agent codex
pmdocs install skill --agent claude
Then ask Codex or Claude to inspect your codebase and generate or maintain your
docs using the installed payload-markdown-docs and payload-markdown skill
instructions.
The installed skills give the agent repo-local guidance for:
payload-markdown skill.You can still write every document by hand. In fact, you should review and tune important docs by hand. But the workflow is optimized for AI to build the first pass, maintain large sections, and keep documentation moving with the codebase.
Codex and Claude skill packs are included today. The canonical
payload-markdown-docs skill artifacts live in this package. The companion
payload-markdown skill is copied from the installed
payload-markdown package during native CLI packaging.
Payload CMS is excellent for building serious content-backed applications, but documentation delivery usually becomes a side quest:
This package answers those questions with a boringly powerful primitive:
human docs in /docs
agent workflow packs in /skills
server-generated AI discovery in /llms.txt and /llms-full.txt
Your docs live in the repo. The native pmdocs CLI validates and publishes
them. GitHub Actions or Ed25519 signs the request. Payload stores and renders
the output. Your site owns the final output.
/docs.<group...>/<doc-set>/skills/<agent>.pmdocs commands for validation, manifest generation, sync planning,
route installation, key generation, and publishing.docs/stack.toml (title, description,
categorized technology stack), shown on preview cards.payload-markdown-docs-consumer) for listing projects from
several docs sites, for example on a portfolio.payload-markdown.pnpm add payload-markdown-docs payload-markdown @payloadcms/plugin-seo
payload-markdown (Markdown field and renderer) and
@payloadcms/plugin-seo (docs-set SEO fields) are peer dependencies: the
plugin registers admin components from both packages in your app's import map,
so your app must install them directly. Installing them yourself also keeps a
single copy of payload-markdown, so the payloadMarkdown() options you
configure (themes, code highlighting, icons) apply to docs pages too. Register
payloadMarkdown() in the same Payload config as payloadMarkdownDocs().
payload, next, react and react-dom are peers as well and are already
part of every Payload app.
Both packages are published under two names, built once and released together:
| Package | Preferred | Also published as |
|---|---|---|
| This plugin | payload-markdown-docs | payload-markdown-docs |
| Markdown field and renderer | payload-markdown | payload-markdown |
Install one name of each (any combination works) and import from the names you
installed (payload-markdown-docs/next, payload-markdown-docs/next,
and so on). Both payload-markdown names are optional peer dependencies, so
install the one you use yourself. The plugin finds it on its own: the docs
content field uses the admin component of the installed payload-markdown
(taken from the components payloadMarkdown() registers, so list
payloadMarkdown() first, or from node_modules), and docs pages render with
it. Set payloadMarkdownPackage in payloadMarkdownDocs() to choose explicitly.
With webpack builds (next build --webpack), Next prints one "Module not
found" warning for the payload-markdown name you did not install. It is
harmless: the plugin tries the preferred name first and falls back to the other.
Turbopack builds print nothing.
Switching names in an existing app: replace the dependency and the imports,
update the Tailwind @source paths, and run payload generate:importmap.
Upgrading from 1.0.x: 1.1 adds database schema, including a unique index that needs a one-line data cleanup in your migration. Follow Upgrading to 1.1.
Docs pages and components use Tailwind utility classes from both packages. With Tailwind v4, add both packages to your app stylesheet's sources:
@import "tailwindcss";
@plugin "@tailwindcss/typography";
@source "../node_modules/payload-markdown/dist";
@source "../node_modules/payload-markdown-docs/dist";
Adjust the relative paths to where your stylesheet lives. The components expect
--color-foreground, --color-border and --color-background theme tokens
(shadcn-style text-foreground, border-border, bg-background).
The npm package installs the Payload plugin and runtime helpers. It does not
ship the supported operator CLI. Use the Debian/Ubuntu or Homebrew install
above for the native pmdocs binary.
import { payloadMarkdownDocs } from 'payload-markdown-docs'
import { buildConfig } from 'payload'
export default buildConfig({
plugins: [
payloadMarkdownDocs({
auth: {
githubOidc: true,
},
target: {
enableDrafts: true,
},
sync: {
allowWrites: true,
allowPublish: true,
},
}),
],
})
The package surface is intentionally split by runtime:
payload-markdown-docs: Payload plugin/config API only.payload-markdown-docs/next: Next rendering, metadata, sitemap, nav, route, and asset route helpers.payload-markdown-docs/admin: DocsSetManager for Payload import maps.payload-markdown-docs/blocks: optional Payload block schemas and field helpers.payload-markdown-docs/mcp: MCP tools for @payloadcms/plugin-mcp (server-only).Other sites read the opt-in projects API (publicApi: { projects: true }) with the separate,
dependency-free payload-markdown-docs-consumer package.
Manual block installation imports from /blocks:
import { DocsCTABlock } from 'payload-markdown-docs/blocks'
This adds the Docs Globals admin collections:
Sets: documentation packages. The set slug is the sync source and OIDC audience.Groups: optional route nesting. Routes are derived from group slugs.Access: GitHub OIDC trust records and Ed25519 public keys for publishing.The sync endpoint is:
/api/documentation/sync
The sync endpoint is an implementation endpoint. Public raw AI asset URLs such
as /llms.txt and /plugins/<docs-set>/skills/<agent> require committed Next
route files; install those once with pmdocs install routes.
Create a docs set:
title: Payload Markdown Docs
slug: payload-markdown-docs
branch: main
group: plugins
With the plugins group, the generated route becomes:
/plugins/payload-markdown-docs
Create a trusted GitHub owner:
owner: valkyrianlabs
limitRepos: false
When limitRepos is disabled, any repository owned by that GitHub owner can
publish to a matching docs set from the configured branch.
Enable limitRepos when you want to explicitly list the allowed repositories.
A minimal docs tree can look like this:
docs/
index.md
getting-started/
quick-start.md
configuration/
plugin-config.md
workflow/
ci-github-actions.md
reference/
cli.md
skills/
payload-markdown-docs/
codex/
SKILL.md
claude/
SKILL.md
The Markdown files are the source of truth. Native agent workflow packs live
outside the docs tree under skills/payload-markdown-docs/<agent>/.
/llms.txt, /llms-full.txt, and docs-set llms files are generated by the
plugin from synced docs, docs set metadata, dependencies, and skills.
The plugin does not require generated-only docs, hidden storage, or a hosted documentation service. AI can create the tree, but humans can edit it like any other Markdown project.
In the repository that owns the docs tree:
pmdocs install skill --agent codex
pmdocs install skill --agent claude
The Codex installer writes both skill packages:
.agents/skills/payload-markdown-docs/
.agents/skills/payload-markdown/
The Claude installer writes both skill packages:
.claude/skills/payload-markdown-docs/
.claude/skills/payload-markdown/
The installer does not sync docs, call Payload, or publish content. It only
installs agent-facing guidance so AI agents can understand the documentation
rules inside your repo. The payload-markdown-docs skill covers package
structure and sync behavior. The companion payload-markdown skill covers
renderer directives and Markdown authoring.
After upgrading pmdocs or payload-markdown, pmdocs skill update refreshes
both installed skills (pmdocs skill check reports whether they are current).
Agents do this on their own: the skill tells them to, and pmdocs validate
reminds them when the installed copy is stale.
A typical prompt after installing the skill:
Use the installed payload-markdown-docs skill.
Analyze this repository and generate a complete documentation tree under /docs.
Use route-aware frontmatter and payload-markdown-compatible Markdown. Validate
the tree with pmdocs when finished.
That is the magic trick: the AI does not just write random docs. It writes docs for a known renderer, known metadata format, known CLI, and known publishing pipeline.
Before syncing, validate the docs tree:
pmdocs validate --source payload-markdown-docs
Generate a manifest:
pmdocs manifest \
--source payload-markdown-docs \
--pretty
Preview the sync plan:
pmdocs plan --source payload-markdown-docs
With --endpoint and push credentials, plan asks the server for a dry-run plan and prints
its Markdown diagnostics (payload-markdown renderer findings, broken links and anchors) as
path:line:col severity code message; --strict exits 1 on any warning or error, and
pmdocs push --strict makes the server reject the sync before writing anything.
Pass --source explicitly in CI. It must match the docs set slug in Payload
Admin. The CLI can derive it from GITHUB_REPOSITORY when the docs set slug
matches the repository name, but explicit source ids make workflow intent
auditable and avoid publishing the wrong docs set.
This is the default documentation CI workflow.
GitHub Actions signs the publish request with OIDC. Payload verifies the trusted owner, repository, branch, and docs set before accepting the sync.
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install pmdocs
run: |
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://apt.valkyrianlabs.com/pubkey.gpg \
-o /etc/apt/keyrings/valkyrianlabs.gpg
sudo chmod 0644 /etc/apt/keyrings/valkyrianlabs.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/valkyrianlabs.gpg] https://apt.valkyrianlabs.com stable main" | \
sudo tee /etc/apt/sources.list.d/valkyrianlabs.list > /dev/null
sudo apt-get update
sudo apt-get install -y pmdocs
- run: pmdocs --version
- run: pmdocs validate --source payload-markdown-docs
- run: |
pmdocs push \
--endpoint "$DOCS_SYNC_ENDPOINT" \
--source payload-markdown-docs \
--github-oidc \
--publish
OIDC authentication does not require --repository, --branch, or --commit.
Payload verifies the trusted owner, repository, branch/ref, commit SHA, and
docs set audience from GitHub's OIDC token claims. Those CLI flags only add
optional source metadata to the manifest and are usually unnecessary in GitHub
Actions workflows.
push defaults to sync mode and publishes the conventional package layout:
human docs from ./docs and native skill artifacts from ./skills/<source> when
that directory exists. Projects do not need to ship skills; a missing default
./skills directory is skipped. AI discovery files are generated at request
time; root llms.txt files are only needed when you intentionally provide
custom static fallback assets.
Sync writes require:
sync: {
allowWrites: true,
}
--publish also requires:
sync: {
allowPublish: true,
},
target: {
enableDrafts: true,
}
This is the normal “CI for your documentation” path: commit docs, validate docs, push docs, publish docs.
For advanced on-demand workflows, use Ed25519 signed pushes.
This is useful when you want to publish from your editor, local machine, internal tooling, or a non-GitHub environment without waiting on a GitHub workflow.
Generate a keypair:
pmdocs keygen --out .docs-sync
Add the public key in Payload Admin:
Docs Globals > Access
Then push with the private key:
pmdocs push \
--endpoint "$DOCS_SYNC_ENDPOINT" \
--source payload-markdown-docs \
--key-id local-docs \
--private-key-file .docs-sync/docs-sync-private.pem
For immediate publishing:
pmdocs push \
--endpoint "$DOCS_SYNC_ENDPOINT" \
--source payload-markdown-docs \
--key-id local-docs \
--private-key-file .docs-sync/docs-sync-private.pem \
--publish
That is the operator workflow: edit locally, validate locally, push directly, and review the rendered docs on your Payload site.
Before v1, docs publishing used the npm package binary:
pnpm exec payload-markdown-docs push ...
Use the native binary instead:
pmdocs push ...
Keep payload-markdown-docs installed in the Payload app for the
plugin/runtime integration. Install pmdocs from Homebrew or the Valkyrian
Labs Debian repository anywhere you run operator commands.
The plugin does not mutate your Pages collection and does not register public frontend routes.
Resolve docs from the same slug route that renders your normal Pages collection. Render docs first when they match, then fall back to your existing Pages query.
import config from '@payload-config'
import {
PayloadMarkdownDocsPage,
getPayloadMarkdownDocsRoutePath,
resolvePayloadMarkdownDocsRoute,
} from 'payload-markdown-docs/next'
import { notFound } from 'next/navigation'
import { getPayload } from 'payload'
export const dynamic = 'force-dynamic'
export default async function Page({ params }: { params: Promise<{ slug?: string[] }> }) {
const { slug = [] } = await params
const path = getPayloadMarkdownDocsRoutePath({ path: slug })
const payload = await getPayload({ config })
const resolved = await resolvePayloadMarkdownDocsRoute({
payload,
path,
})
if (resolved) {
return <PayloadMarkdownDocsPage resolved={resolved} />
}
const page = await queryPageByPath({ path })
if (page) {
return <RenderPage page={page} />
}
notFound()
}
queryPageByPath and RenderPage are placeholders for your app's existing
Pages loader and renderer.
path accepts a normalized route string, a single [slug] string, or a
[...slug] / [[...slug]] string array. The older slug option remains
supported, but path is clearer for new route integrations.
Use a catch-all route such as app/(frontend)/[[...slug]]/page.tsx when
possible. If an existing [slug] route must stay in place, use the same
resolver-first flow there and add a [...slug] route for nested docs pages. For
@payloadcms/plugin-nested-docs, query fallback Pages by a stored full path
such as fullPath; otherwise keep using the route field your Pages collection
already uses.
See Route Adapter for complete integration notes and metadata examples.
Use the drop-in navbar when you want the plugin to own the docs menu UI:
import { PayloadMarkdownDocsNavbar } from 'payload-markdown-docs/next'
import type { Payload } from 'payload'
export async function HeaderDocsNav({ payload }: { payload: Payload }) {
return (
<PayloadMarkdownDocsNavbar currentPath="/plugins/payload-markdown-docs" payload={payload} />
)
}
The navbar reads docs groups and docs sets, renders nested docs navigation, and
accepts classNames and renderLink overrides for app-specific Tailwind,
routing, and analytics.
If you already have a site header, use the Header adapter to append top-level docs groups and top-level ungrouped docs sets without exceeding your existing menu cap:
import { appendPayloadMarkdownDocsHeaderNavItems } from 'payload-markdown-docs/next'
const navItems = await appendPayloadMarkdownDocsHeaderNavItems({
existingItems: header.navItems ?? [],
maxItems: headerNavItemsMaxRows,
payload,
})
The adapter defaults to custom URL links, so it does not require CMSLink changes.
Use mode: 'relationship' only when your renderer understands docs-groups
and docs-sets relationships.
For fully custom navigation, use the headless nav builder:
import { getPayloadMarkdownDocsNavItems } from 'payload-markdown-docs/next'
const docsNav = await getPayloadMarkdownDocsNavItems({
availableSlots: 4,
payload,
})
The canonical agent artifacts are normal files under skills/. push syncs
them as raw asset records by convention. Synced assets are stored separately
from docs records. Skill files are not docs records and do not need docs
frontmatter. AI discovery files are generated by the plugin; checked-in
llms.txt and llms-full.txt files are only custom static fallbacks.
Payload owns the asset storage and handlers, but a Next App Router site still needs filesystem route files so public root URLs reach those handlers instead of the frontend catch-all. Install the exact public Next route files once:
pmdocs install routes --payload-app "src/app/(payload)"
Use --payload-app "app/(payload)" for apps without src/. The route files
delegate to the plugin-owned asset handlers and prevent generated /llms.txt
and skill URLs from being swallowed by a frontend catch-all.
The /api/... asset URLs are implementation/internal fallback URLs. They are
useful for debugging, but the public canonical routes are outside /api.
When push includes skill assets or custom static assets, the CLI warns if
those public route files are missing from the current app. Use
--strict-routes in CI to fail the publish before deploying assets that would
only be reachable under /api.
Useful stable paths include:
/llms.txt
/llms-full.txt
/plugins/payload-markdown-docs/llms.txt
/plugins/payload-markdown-docs/llms-full.txt
/plugins/payload-markdown-docs/skills/codex
/plugins/payload-markdown-docs/skills/codex/SKILL.md
/plugins/payload-markdown-docs/skills/codex.zip
/plugins/payload-markdown-docs/skills/codex/reference
/plugins/payload-markdown-docs/skills/claude
/plugins/payload-markdown-docs/skills/claude/SKILL.md
/plugins/payload-markdown-docs/skills/claude.zip
/plugins/payload-markdown-docs/skills/codex/reference/workflow.md
/skills/<agent> is a generated Markdown directory index for the synced skill
bundle. /skills/<agent>/<directory> is also generated as a Markdown index when
that directory exists. Raw files remain available at
/skills/<agent>/SKILL.md and /skills/<agent>/<path...>.
Skill ZIP routes are generated on demand from synced text skill artifacts in
./skills/<sourceId>/<agent>/.... They are not uploaded or stored as static ZIP
assets. Archives expand to <sourceId>/SKILL.md plus supporting files.
Auto-resolved skill CTAs point to the ZIP route.
Generated llms.txt links use the public app origin when configured, preferring
NEXT_PUBLIC_SERVER_URL, then public site/Vercel URL environment values before
falling back to request headers or Payload serverURL. Production output should
not emit localhost when a public origin is configured.
Generated sitemap output includes canonical human docs pages by default. Raw
AI-facing routes like llms.txt, llms-full.txt, and native skill Markdown are
publicly served but are not listed in sitemap.xml unless explicitly requested
with includeLlms or includeSkills. Synced static assets are also hidden
unless includeAssets is enabled; includeAssets does not include llms or
skills. Use additionalRoutes for static routes that are not generated or
synced:
import { getDocsForSitemap } from 'payload-markdown-docs/next'
const sitemap = await getDocsForSitemap({
payload,
siteUrl,
additionalRoutes: [{ path: '/agent-index.txt' }],
})
sitemap.xml is crawler discovery. llms.txt is an AI-readable entrypoint.
Skills are native agent workflow artifacts.
The source split is intentional: /docs contains human documentation, while
/skills contains agent-native workflow packages.
payload-markdown-docs/mcp adds docs tools to Payload's official MCP
plugin, alongside payload-markdown's markdown tools (either wrapper order works):
import { mcpPlugin } from '@payloadcms/plugin-mcp'
import { withPayloadMarkdownMcp } from 'payload-markdown/mcp'
import { withPayloadMarkdownDocsMcp } from 'payload-markdown-docs/mcp'
mcpPlugin(withPayloadMarkdownMcp(withPayloadMarkdownDocsMcp({ collections: { pages: { enabled: true } } })))
Agents can change presentation fields, publish, roll back to Git snapshots, manage docs sets, groups and sync access, and read sync runs. They cannot overwrite synced content: Git owns doc bodies and frontmatter, and the plugin rejects those writes from every MCP tool. See MCP Agent Tools.
You do not need this for normal docs publishing.
Each docs set has an advanced security section for exact GitHub workflow refs.
Leave it disabled to allow any workflow from a trusted owner/repository on the configured branch.
When enabled, add every allowed workflow ref explicitly. An empty list rejects all workflow publishing for that docs set.
MIT
payload plugin docs
Keeps a reviewed docs page for each feature your site lists, with a publish-time lint for internal details
78367/wk0v3
content freeze
Block create, update and delete on chosen collections and globals while a content freeze is active
85207/wk115v4
payload better editor
Side-by-side live-preview iframe with a sidebar for editing individual blocks in the Payload edit view
781.2k/wk119v3
payload plugin scheduling
Schedule future publication of drafts on collections and globals with a secured cron endpoint
77783/wk37v3
payload plugin comments
Document-level and field-level comments with mentions, resolution and email notifications for Payload admin
757.0k/wk37v3
payload plugin html preview
Live preview and click-to-edit in the Payload admin for any frontend that renders HTML, no framework needed
74451/wk37v3