Download the PHP package kozmozio/kirby-llms without Composer
On this page you can find all versions of the php package kozmozio/kirby-llms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kozmozio/kirby-llms
More information about kozmozio/kirby-llms
Files in kozmozio/kirby-llms
Package kirby-llms
Short Description A Kirby CMS plugin that generates an llms.txt file for Large Language Models
License MIT
Homepage https://github.com/kozmozio/kirby-llms#readme
Informations about the package kirby-llms
Kozmoz Kirby LLMs Plugin
A Kirby CMS plugin that generates an llms.txt file in the root of your website or responds to the llms.txt route with necessary information for Large Language Models (LLMs)
Overview
This plugin creates an llms.txt file that provides structured information about your website to help Large Language Models better understand and interact with your content. Similar to how robots.txt works for search engines, llms.txt provides guidance for LLMs.
Features
- Generates an
llms.txtfile in the root of your website in Markdown format - Generates an XML sitemap at
sitemap.xmlusing the same page filtering as LLMs.txt - Provides dedicated routes to access both LLMs information and sitemap
- Creates proper Markdown links for pages with trailing slashes (configurable)
- Strips HTML tags from descriptions and metadata for clean output
- Configurable exclusion of pages and templates
- Configurable inclusion of pages that override exclusions
- Groups pages by parent page name or template type with section headings (e.g.
## Blog,## Products) - Automatic cache clearing when content changes
- Supports configuration via your site's main config.php file
- Panel integration for easy configuration through the Kirby admin interface
Installation
Manual Installation
- Download or clone this repository
- Place the folder
kirby-llmsin yoursite/pluginsdirectory - Rename the folder to
kirby-llmsif needed
Composer Installation
Configuration
Via Config File
You can configure the plugin by adding options to your config.php file:
Via Kirby Panel
The plugin also provides a panel interface for configuring the settings. To enable this, you need to add the LLMs tab to your site blueprint.
- Add the LLMs tab to your
site.ymlblueprint:
This will add a new "LLMs" tab to your site settings in the panel, where you can configure:
- Enable/disable the LLMs.txt generation
- Enable/disable the XML sitemap generation
- Enable/disable caching
- Set cache duration
- Enable/disable adding trailing slashes to URLs
- Choose page grouping strategy (by parent, by template, or no grouping)
- Exclude templates and pages
- Include pages that should always be visible despite exclusions
Blueprint Structure
The plugin uses the following blueprint structure:
You can customize these blueprints by copying them to your site's blueprint directory and modifying them as needed:
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Enable or disable serving llms.txt |
sitemap_enabled |
boolean | true |
Enable or disable XML sitemap generation |
cache |
boolean | false |
Enable or disable caching |
cache.duration |
integer | 60 |
Cache duration in minutes |
add_trailing_slash |
boolean | true |
Whether to add trailing slashes to URLs in the output |
group_by |
string | 'parent' |
Group pages by: 'parent' (parent page name), 'template' (template type), or 'none' (flat list) |
exclude.templates |
array | ['error'] |
Templates to exclude from the output |
exclude.pages |
array | [] |
Pages to exclude from the output |
include.pages |
array | [] |
Pages to always include despite exclusions |
Excluding Pages
You can exclude specific pages from the llms.txt output by adding their slugs to the exclude.pages array in your configuration. The plugin performs matching on:
- Exact page ID or URI match
- Pages with the same name in different locations (e.g., if you exclude 'inan-olcer', both 'inan-olcer' and 'team/inan-olcer' will be excluded)
- Child pages of excluded parents
- Pages with URIs containing specific strings (e.g., if you exclude 'faq', all pages with 'faq' in their URI will be excluded)
For example:
Including Pages (Override Exclusions)
You can specify pages that should always be included in the output, even if they would normally be excluded by template or page exclusion rules. This is useful when you want to exclude a template globally but include specific pages that use that template.
The include.pages option overrides all exclusion rules and uses the same matching logic as exclusions:
- Exact page ID or URI match
- Child pages of included parents
- Pages with URIs containing the included string
For example:
In this example:
- All
faqsandcontacttemplate pages are excluded by default - But pages under
faqs/(likefaqs/question-one) will be included becausefaqsis in the include list - The
contactpage will be included despite using the excludedcontacttemplate - Any page with
important-faqin its URI will be included
Include rules always take precedence over exclude rules.
Usage
Once installed, the plugin automatically sets up two routes:
yourdomain.com/llms.txt- Generates the LLMs information in Markdown formatyourdomain.com/sitemap.xml- Generates an XML sitemap using the same page filtering
The LLMs content will be in Markdown format with proper Markdown links for pages and their descriptions. The sitemap will be in standard XML format following the sitemap protocol. All HTML tags are automatically stripped from descriptions and metadata to ensure clean, plain text output.
Automatic Cache Clearing
The plugin automatically clears its cache when:
- Pages are created, updated, or deleted
- Page properties change (status, slug, title, template)
- Site information is updated
This ensures that both the llms.txt content and sitemap.xml are always up-to-date with your website's content.
Example Output
LLMs.txt Output
With default group_by: parent:
With group_by: none (flat list):
Sitemap.xml Output
Static Site Generation
If you're using a static site generator with Kirby, make sure to include both routes in your static routes:
Development Status
Phase 1: Basic Structure and Setup ✓
- Create plugin folder structure ✓
- Set up plugin initialization ✓
- Register the route for
llms.txt✓ - Implement basic configuration options ✓
Phase 2: Core Functionality ✓
- Develop the content generator for
llms.txt✓ - Implement page collection and filtering ✓
- Create the response formatter ✓
- Add caching mechanism ✓
Phase 3: Advanced Features ✓
- Add customization options for content exclusion ✓
- Implement metadata extraction ✓
- Add automatic cache clearing when content changes ✓
- Strip HTML tags from descriptions and metadata ✓
- Ensure URLs have trailing slashes ✓
Phase 4: Testing and Documentation ✓
- Test with different Kirby setups ✓
- Create comprehensive documentation ✓
- Add examples and use cases ✓
- Prepare for release ✓
Author
License
MIT