LLMS.txt Generator
The LLMS.txt Generator plugin creates a standardized llms.txt file in your site's root directory. This file helps large language models - like ChatGPT, Claude, or Gemini - understand your site's structure and find your most important content.
The plugin works during site generation. It scans your posts and pages, organizes them based on your priorities, and outputs a clean markdown file with links and descriptions. No runtime overhead. No JavaScript. Just a static file that AI models can read instantly.
You control what gets included, in what order, and how it's labeled. The plugin handles duplicate prevention automatically, supports manual curation of key resources, and lets you customize section headings to match your site's language.
Using Markdown for AI plugin? LLMS.txt Generator detects it automatically and can link directly to available Markdown versions of your posts and pages. See how the integration works.
Enabling the Plugin
Open Publii and navigate to Tools & Plugins. Find LLMS.txt Generator in your plugin list and activate it using the toggle at the bottom-left corner of its tile.
Once enabled, the plugin reveals its configuration panel. Default settings work right away, but you'll likely want to customize which content appears and in what order.
How the Plugin Works
Understanding the plugin's data flow helps you configure it effectively. Here's what happens during site generation:
Data Collection
The plugin hooks into Publii's rendering process through the afterRender event. At this point, Publii has prepared your full content structure - all posts, pages, tags, and metadata - and generated the site's output files. This allows the plugin to confirm that a Markdown file exists before using its address in llms.txt.
The plugin grabs this content structure and starts building the llms.txt file. It pulls from several sources:
- Posts collection - all published posts with their titles, URLs, tags, meta descriptions, and featured status
- Pages collection - all published pages with their titles, URLs, and meta descriptions
- Site configuration - global settings like site name and description
- Your manual selections - any posts, pages, or custom links you explicitly chose in plugin settings
Processing Order
The plugin builds llms.txt section by section, always following the same sequence. This matters because later sections skip content that already appeared earlier. No duplicates.
Here's the exact order:
- Site name and description - The file header. For the site name, the plugin uses your custom site name from plugin settings, or falls back to Publii's Page title (Site Settings → Advanced Options → SEO), then to the regular Site name (Site Settings → Basic Options → Site Name). For the description, it uses your custom description from plugin settings, or falls back to Publii's meta description (Site Settings → Advanced Options → SEO).
- Introductory notes - Optional custom sections you can add at the top. Maybe you want to highlight support contact info, key topics, or usage guidelines. These appear before any automatic content.
- Key Resources - Your manually curated content. Posts, pages, and custom links you explicitly selected. This section always appears first among content listings, ensuring your most important material gets top placement.
- Featured Articles - If enabled, all posts marked as "Featured" in Publii. Any post already listed in Key Resources gets skipped here.
- Main Topic sections - If enabled, the plugin groups remaining posts by their main tag. Each tag gets its own heading with its assigned posts underneath. If a post doesn't have a manually assigned main tag but has tags assigned, Publii automatically treats the first tag as the main tag (this is Publii's default behavior). Only posts without any tags at all or posts already shown in earlier sections won't appear here.
- Latest Articles - If enabled, the most recent posts not yet included anywhere. You control how many show up (default is 15, or -1 for all remaining posts).
- Pages - If enabled, all published pages that weren't manually selected earlier. Things like Contact, About, Privacy Policy.
This top-to-bottom processing means your manual selections always win. If you add a post to Key Resources, it won't appear again in Featured Articles or Latest Articles. The plugin tracks every post and page ID as it goes, maintaining a "processed" set that prevents repeats.
Description Selection Logic
For each entry, the plugin needs a description. It follows a priority chain to pick the best available text:
- Custom description from manual resource settings - If you manually selected this post/page and wrote a custom description, that wins.
- Post/page meta description - The individual meta description from that specific post or page's SEO settings (found in the post/page editor under the SEO tab). The plugin only uses this if it exists.
- Excerpt - Publii automatically generates an excerpt from the beginning of the post or page content.
- Empty string - If nothing else exists, the link appears without a description.
The plugin also cleans descriptions before output. It converts HTML entities (like and …) to plain text equivalents, removes line breaks, and collapses multiple spaces. This ensures clean, readable markdown.
Output Format
The final llms.txt file uses straightforward markdown:
# Your Site Name
> Your site description
## Important Notes
This site covers web development tutorials and best practices.
For support, contact us at support@example.com
## Key Resources
- [Important Guide](https://example.com/guide): Complete guide to getting started
## Featured Articles
- [How to Use Feature X](https://example.com/feature-x): Step-by-step tutorial
## Main Topic: Tutorials
- [Tutorial One](https://example.com/tutorial-1): Learn the basics
- [Tutorial Two](https://example.com/tutorial-2): Advanced techniques
## Latest Articles
- [Recent Post](https://example.com/recent): What's new this week
## Pages
- [Contact](https://example.com/contact): Get in touch with our team
Clean. Scannable. Perfect for AI parsing.
When the Markdown for AI integration is active, eligible post and page URLs in this file can point to their .md versions. The original HTML address is used whenever a Markdown file is unavailable.
Plugin Configuration
General Settings
These control your llms.txt file's header, preferred link format, and optional introductory sections.
Site Name - The main heading of your llms.txt file. If left empty, the plugin follows this priority chain: first it checks Publii's Page title (found in Site Settings → Advanced Options → SEO), then falls back to the regular Site name (Site Settings → Basic Options → Site Name). This field is useful if you want your llms.txt to show a different name than what appears on your actual website.
Site Description - A brief summary of what your site covers, displayed as a markdown quote block under the site name. Leave empty to use Publii's global meta description (found in Site Settings → Advanced Options → SEO). This description helps AI models understand your site's purpose before diving into individual posts.
Prefer Markdown Links - Enabled by default. When the Markdown for AI plugin is active for the same website, links to eligible Publii posts and pages point to their generated
.mdversions.Before changing an address, LLMS.txt Generator checks that the Markdown file exists in the current site output. If it is unavailable, the original HTML address is used automatically. Custom links are never modified. Disable this option if you always want llms.txt to use HTML addresses.
Optional Notes - A repeater field where you can add custom sections at the top of the file, before any automatic content. Each note has two parts: a heading and content. Use these for things like:
- Important disclaimers or usage guidelines
- Support contact information
- Key topics your site covers
- Instructions for AI models on how to reference your content
You can add as many notes as you need. If you want to create lists in the note content, start each entry with a hyphen, e.g.,
- JavaScript tutorials and guides - For support contact hello@example.com - Updated weekly with new content
Manual Content
This section gives you complete control over your highest-priority content. Anything you add here appears in the "Key Resources" section at the top of your content listings, before any automatic sections.
Key Resources - Posts - Select specific posts to feature. For each post:
- Select a Post - A dropdown with all your posts. Pick the one you want to include.
- Title (optional) - Override the post's actual title if you want the llms.txt link to say something different. Leave empty to use the post's real title.
- Description (optional) - Write a custom description for this post. If empty, the plugin uses the post's individual meta description (from the SEO tab in the post editor), then its automatically generated excerpt.
Use this for evergreen guides, your most important tutorials, or cornerstone content that defines your site.
Key Resources - Pages - Works exactly like posts, but for pages. Select a page, optionally override its title and description. If you don't provide a custom description, the plugin uses the page's individual meta description (from the SEO tab in the page editor), then its automatically generated excerpt. Useful for highlighting pages like "Start Here," "About," or "How It Works."
Key Resources - Custom Links - Add links to external resources or internal content not managed by Publii. Each entry has three fields:
- Title - The link text that appears in llms.txt. Required.
- URL - The full URL. Can point anywhere - external sites, direct links to PDFs, whatever. Required.
- Description (optional) - Brief text explaining what this link offers.
This is perfect for linking to GitHub repositories, documentation hosted elsewhere, downloadable resources, or partner sites.
Skip duplicates in automatic sections - When enabled (default), any post or page you manually select won't appear again in Featured Articles, Latest Articles, or other automatic sections. This keeps your llms.txt file clean and prevents repetition. Disable this only if you deliberately want content to appear multiple times.
Automatic Content Rules
These checkboxes control which sections the plugin automatically generates. The plugin processes content top-to-bottom and tracks what it's already included, so posts appearing in earlier sections never repeat in later ones.
Include all 'Featured' posts - Disabled by default. Adds a "Featured Articles" section with every post you've marked as featured in Publii. Featured posts appear after Key Resources but before topic-grouped content. If you've already added a featured post to Key Resources manually, it gets skipped here.
Use featured posts for seasonally important content, recent highlights, or posts you want to promote temporarily without manual management.
Group posts by their 'Main Tag' - Disabled by default. Creates separate sections for each main tag you've assigned to posts. The heading format is "Main Topic: TagName" (customizable in Localization settings).
Each post in Publii can have one main tag. If you don't explicitly set a main tag, Publii automatically uses the first assigned tag as the main one. Only posts without any tags at all don't appear in these sections.
This organization helps AI models understand your content structure. A tech blog might have sections like "Main Topic: JavaScript," "Main Topic: Python," and "Main Topic: DevOps." Posts already shown in Key Resources or Featured Articles won't duplicate here.
Include Latest posts - Enabled by default. Adds a "Latest Articles" section with your most recent posts, in chronological order. Only posts not yet listed elsewhere appear here. You control the quantity with the next setting.
Skip 'hidden' posts in Latest - Enabled by default. When turned on, posts marked as hidden are excluded from the "Latest Posts" list.
Number of Latest posts to include - Controls how many recent posts appear in the Latest Articles section. Accepts values from -1 upward. Set to -1 to include all remaining posts (every post on your site that hasn't appeared in earlier sections). Set to 0 to disable this section entirely despite having "Include latest posts" checked.
Think about your site's update frequency. A blog publishing daily might want 15-20 posts here. A site posting weekly might need fewer.
Include all Pages - Disabled by default. When enabled, adds a final "Pages" section with links to all your published pages. Pages manually added to Key Resources get skipped here. Useful for ensuring AI models can find your Contact, About, Privacy Policy, and similar pages.
Localization
Override default section headings to match your site's language. All fields show the English default but accept any text you want.
- Heading: Key Resources - Section title for manually selected content. Default: "Key Resources"
- Heading: Featured Articles - Section title for featured posts. Default: "Featured Articles"
- Heading prefix: Main topic - Label before each tag name in grouped sections. Default: "Main Topic" (outputs as "Main Topic: YourTag"). If your input ends with a colon, the plugin uses it as-is. Otherwise, it adds the colon automatically.
- Heading: Latest Articles - Section title for recent posts. Default: "Latest Articles"
- Heading: Pages - Section title for pages. Default: "Pages"
Working with Markdown for AI
LLMS.txt Generator works independently, but it can also be paired with the Markdown for AI plugin. The two plugins handle different parts of content discovery:
- LLMS.txt Generator creates a concise index that introduces the website and points to its most important resources.
- Markdown for AI creates clean Markdown versions of individual Publii posts and pages.
No manual connection is required. When both plugins are active for the same website and Prefer Markdown Links is enabled, LLMS.txt Generator uses available Markdown addresses for manually selected Publii posts and pages as well as content added through the automatic sections.
Each Markdown file is checked individually. If a post or page is marked noindex, excluded through the Markdown for AI settings, unavailable during Preview, or could not be generated, llms.txt keeps its original HTML address. Custom links and external resources are always left unchanged.
The integration also works in the other direction. When Markdown for AI detects an active LLMS.txt Generator plugin, each generated Markdown document includes a short notice pointing back to the site's main llms.txt content index.
Both plugins continue to work normally when used independently.
Using the Plugin
Once configured, the plugin runs automatically every time you generate your site. No manual steps. No additional actions.
After site generation completes, check your site's root directory. You'll find llms.txt sitting alongside index.html and other root files. Upload this with your normal site sync.
The file will be accessible at https://yoursite.com/llms.txt. You can check it yourself by visiting that URL after uploading your site.
Example: Publii’s homepage exposes its file at https://getpublii.com/llms.txt.
Troubleshooting
The file is empty or missing sections
Look at your configuration:
- If Key Resources is empty and all automatic sections are disabled, you'll get a file with just the site name and description.
- If a post or page appears in one section, it won't appear in later sections (unless you disabled "Skip duplicates in automatic sections"). For example: if you have only one featured post and you add it to Key Resources, it won't show up in Featured Articles - so the Featured Articles section won't appear in the generated file at all, even though the option is enabled.
- If you don't have any featured posts and "Include all 'Featured' posts" is enabled, that section won't appear. Same for tag-grouped sections - if no posts have main tags or tag, nothing shows up.
- If latest posts limit is 0, the Latest Articles section disappears even with the checkbox enabled.
Markdown links are not appearing
Check the following:
- Make sure Markdown for AI is installed and active for the same website.
- Confirm that Prefer Markdown Links is enabled in LLMS.txt Generator.
- Check that Markdown generation is enabled for the relevant content type.
- If you are testing in Preview, enable Generate files during preview in Markdown for AI.
- Check whether the affected post or page is marked
noindex. - Regenerate the website after changing either plugin's settings.
If a Markdown file is unavailable, using the original HTML address is the expected fallback behavior.