logankuzyk

payload plugin llms txt

by logankuzyk
SEO & metadata
v3
^3.0.0
MIT

Overview

Summary generated from the README

Generates an llms.txt index and an optional llms-full.txt with full Markdown content from selected Payload collections. It is registered as a plugin in the Payload config, with an optional admin-editable settings Global. Next.js route handlers serve the files from the site root, and Payload API endpoints are registered for other setups. Requires Payload 3.

Features

  • Builds llms.txt index entries from configurable collections with title, description and URL fields
  • Optional llms-full.txt with rich text converted to Markdown
  • Ordered fallback description fields such as a custom field then the SEO description
  • Optional settings Global with enable toggle and intro override
  • Next.js route handlers for serving files at the site root
  • Limits documents per collection and filters to published documents by default

Use cases

  • Expose site content to LLM crawlers through a standard llms.txt file
  • Publish full Markdown versions of blog posts for AI consumption
  • Let editors toggle llms.txt output and edit its intro from the admin panel

From the author

Payload CMS plugin that generates llms.txt and llms-full.txt from your collections

Installation

npm i payload-plugin-llms-txt

2

Stars

0

Forks

0

Open Issues

4 months ago

Last Updated

185

Weekly Downloads

v0.2.0

npm Version

88.5 KB

Unpacked Size

0

Dependencies

GitHub stars

2+1 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20262
Dec 5, 20262
Dec 4, 20262
Dec 3, 20262
Dec 2, 20262
Dec 1, 20262
Nov 30, 20262
Nov 29, 20262
Nov 28, 20262
Nov 27, 20262
Nov 26, 20262
Nov 25, 20262
Nov 24, 20262
Nov 23, 20262
Nov 22, 20262
Nov 21, 20262
Nov 20, 20262
Nov 19, 20262
Nov 18, 20262
Nov 17, 20262
Nov 16, 20262
Nov 15, 20262
Nov 14, 20262
Nov 13, 20262
Nov 12, 20262
Nov 11, 20262
Nov 10, 20262
Nov 9, 20262
Nov 8, 20262
Nov 7, 20262
Nov 6, 20262
Nov 5, 20262
Nov 4, 20262
Nov 3, 20262
Nov 2, 20262
Nov 1, 20262
Oct 31, 20262
Oct 30, 20262
Oct 29, 20262
Oct 28, 20262
Oct 27, 20262
Oct 26, 20262
Oct 25, 20262
Oct 24, 20262
Oct 23, 20262
Oct 22, 20262
Oct 21, 20262
Oct 20, 20262
Oct 19, 20262
Oct 18, 20262
Oct 17, 20262
Oct 16, 20262
Oct 15, 20262
Oct 14, 20262
Oct 13, 20262
Oct 12, 20262
Oct 11, 20262
Oct 10, 20262
Oct 9, 20262
Oct 8, 20262
Oct 7, 20262
Oct 6, 20262
Oct 5, 20262
Oct 4, 20262
Oct 3, 20262
Oct 2, 20262
Oct 1, 20262
Sep 30, 20261
Sep 29, 20261
Sep 28, 20261
Sep 27, 20261
Sep 26, 20261
Sep 25, 20261
Sep 24, 20261
Sep 23, 20261
Sep 22, 20261
Sep 21, 20261
Sep 20, 20261
Sep 19, 20261
Sep 18, 20261
Sep 17, 20261
Sep 16, 20261
Sep 15, 20261
Sep 14, 20261
Sep 13, 20261
Sep 12, 20261
Sep 11, 20261
Sep 10, 20261
Sep 9, 20261
Sep 8, 20261
Sep 7, 20261
npm weekly downloads

178+165 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026178
Dec 5, 2026148
Dec 4, 2026128
Dec 3, 2026103
Dec 2, 202697
Dec 1, 202699
Nov 30, 202689
Nov 29, 2026107
Nov 28, 2026106
Nov 27, 2026158
Nov 26, 2026157
Nov 25, 2026162
Nov 24, 2026159
Nov 23, 2026153
Nov 22, 2026154
Nov 21, 2026164
Nov 20, 2026118
Nov 19, 2026104
Nov 18, 202693
Nov 17, 202692
Nov 16, 2026100
Nov 15, 202693
Nov 14, 202671
Nov 13, 202676
Nov 12, 202679
Nov 11, 202683
Nov 10, 2026104
Nov 9, 2026121
Nov 8, 2026102
Nov 7, 2026118
Nov 6, 2026107
Nov 5, 2026106
Nov 4, 202695
Nov 3, 202698
Nov 2, 202698
Nov 1, 202697
Oct 31, 202688
Oct 30, 202697
Oct 29, 202688
Oct 28, 202681
Oct 27, 202661
Oct 26, 202632
Oct 25, 202630
Oct 24, 202625
Oct 23, 202615
Oct 22, 202618
Oct 21, 202631
Oct 20, 202639
Oct 19, 202639
Oct 18, 202638
Oct 17, 202631
Oct 16, 202632
Oct 15, 202631
Oct 14, 202618
Oct 13, 20267
Oct 12, 20266
Oct 11, 202611
Oct 10, 202610
Oct 9, 202614
Oct 8, 202613
Oct 7, 202614
Oct 6, 202614
Oct 5, 202615
Oct 4, 202612
Oct 3, 202612
Oct 2, 202611
Oct 1, 202611
Sep 30, 202610
Sep 29, 20269
Sep 28, 20269
Sep 27, 20268
Sep 26, 202612
Sep 25, 202610
Sep 24, 20269
Sep 23, 202613
Sep 22, 202615
Sep 21, 202614
Sep 20, 202619
Sep 19, 202616
Sep 18, 202625
Sep 17, 202627
Sep 16, 202626
Sep 15, 202624
Sep 14, 202626
Sep 13, 202621
Sep 12, 202622
Sep 11, 202611
Sep 10, 202612
Sep 9, 202611
Sep 8, 202611
Sep 7, 202613

Each point is npm's rolling 7-day download count.

Health Score

59/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1318920130-root.svg)](https://payloaddirectory.dev/plugins/1318920130-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1318920130-root"><img src="https://payloaddirectory.dev/badge/1318920130-root.svg" alt="Payload Directory"></a>
Updated Aug 1, 2026Created Aug 1, 2026Published Aug 1, 2026

README

payload-plugin-llms-txt

Generate llms.txt (and optionally llms-full.txt) for a Payload CMS site, straight from your collections.

Install

npm install payload-plugin-llms-txt

Usage

Register the plugin in payload.config.ts to (optionally) add an admin-editable settings Global:

import { llmsTxtPlugin } from 'payload-plugin-llms-txt'

export default buildConfig({
  plugins: [
    llmsTxtPlugin({
      siteName: 'My Site',
      siteDescription: 'A site about things.',
      siteURL: 'https://example.com',
      enableFullText: true,
      addSettingsGlobal: true, // adds an "LLMs.txt Settings" admin global
      collections: [
        {
          slug: 'posts',
          // Tries `llmsDescription` first, falls back to the SEO field when empty —
          // useful when you're rolling out a dedicated LLM-facing description field
          // without having to backfill every existing document immediately.
          descriptionField: ['llmsDescription', 'meta.description'],
          contentField: 'content', // richText field, converted to Markdown for llms-full.txt
          urlPath: (doc) => `/posts/${doc.slug}`,
        },
        {
          slug: 'pages',
          urlPath: (doc) => `/${doc.slug}`,
          // no contentField for block-based layouts — the page still appears in the
          // index, just without full-text content in llms-full.txt
        },
      ],
    }),
  ],
})

llms.txt should be served from your site's root, not under /api, so in Next.js apps add route handlers using the /next export instead of relying on the Payload-native endpoint:

// app/llms.txt/route.ts
import config from '@payload-config'
import { createLlmsTxtRouteHandler } from 'payload-plugin-llms-txt/next'

export const GET = createLlmsTxtRouteHandler(config, {
  /* same options object as above */
})
// app/llms-full.txt/route.ts
import config from '@payload-config'
import { createLlmsFullTxtRouteHandler } from 'payload-plugin-llms-txt/next'

export const GET = createLlmsFullTxtRouteHandler(config, {
  /* same options object as above */
})

For non-Next.js consumers, the plugin also registers GET /llms.txt and GET /llms-full.txt under Payload's configured API route (e.g. /api/llms.txt) automatically.

Options

OptionTypeDefaultDescription
collectionsLlmsTxtCollectionConfig[]—Which collections to include, and how to read/link each document.
siteNamestring—Heading at the top of the generated file.
siteDescriptionstring—Intro blurb, unless overridden by the settings Global.
siteURLstring—Base URL used to build absolute links.
enableFullTextbooleanfalseAlso generate llms-full.txt with full Markdown content inline.
addSettingsGlobalboolean | stringfalseAdds an admin-editable Global (enable toggle + intro override). Pass a string to customize its slug.
limitPerCollectionnumber1000Max documents fetched per collection.

LlmsTxtCollectionConfig

OptionTypeDefaultDescription
slugstring—Collection slug.
titleFieldstring'title'Field used as the entry title.
descriptionFieldstring | string[]—Dot-path field used as the index description (e.g. 'meta.description'), or an ordered array of fallback fields — the first one with a non-empty value wins (e.g. ['llmsDescription', 'meta.description']).
contentFieldstring—richText field name to convert to Markdown for llms-full.txt. Omit for block-based layouts (e.g. Payload's block-based Pages) — those entries stay index-only.
urlPath(doc) => string—Builds the document's public path.
publishedOnlybooleantrueFilter to _status: 'published'. Set false for collections without drafts/versions.
labelstringCapitalized slugSection heading in the index.

Limitations

  • Block-based layout fields (e.g. Payload's Pages template with a layout array of blocks) aren't flattened to Markdown in v1 — configure contentField only for collections with a single richText field.
  • llms-full.txt uses editorConfigFactory.default() for Markdown conversion; highly custom per-field Lexical features may not fully round-trip.

License

MIT

Similar plugins