npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

payload-plugin-llms-txt

v0.2.0

Published

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

Downloads

322

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

| Option | Type | Default | Description | | -------------------- | ------------------------------------ | -------- | -------------------------------------------------------------------------- | | collections | LlmsTxtCollectionConfig[] | — | Which collections to include, and how to read/link each document. | | siteName | string | — | Heading at the top of the generated file. | | siteDescription | string | — | Intro blurb, unless overridden by the settings Global. | | siteURL | string | — | Base URL used to build absolute links. | | enableFullText | boolean | false | Also generate llms-full.txt with full Markdown content inline. | | addSettingsGlobal | boolean \| string | false | Adds an admin-editable Global (enable toggle + intro override). Pass a string to customize its slug. | | limitPerCollection | number | 1000 | Max documents fetched per collection. |

LlmsTxtCollectionConfig

| Option | Type | Default | Description | | ------------------- | ----------------------------------- | -------------- | -------------------------------------------------------------------- | | slug | string | — | Collection slug. | | titleField | string | 'title' | Field used as the entry title. | | descriptionField | string \| 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']). | | contentField | string | — | 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. | | publishedOnly | boolean | true | Filter to _status: 'published'. Set false for collections without drafts/versions. | | label | string | Capitalized slug | Section 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