The AI Resources Page plugin automates the generation of an "AI Resources" page for your documentation site. It processes a configuration file (llms_config.json) to dynamically build an overview section and a table of resources (global files and category bundles) optimized for LLMs.
This plugin is included in the papermoon-mkdocs-plugins package.
pip install papermoon-mkdocs-pluginsAdd the plugin to your mkdocs.yml:
plugins:
- ai_resources_pageThe plugin relies on an llms_config.json file in your project root to determine what content to generate.
Key sections used by this plugin:
project:name: The name of your project (e.g., "Polkadot"). Required.
content:categories_info: A dictionary of category metadata. Key order controls the display order in the table. Each value containsnameanddescription.
outputs:public_root: The URL path where AI artifacts are served (default:/ai/).
{
"project": {
"name": "My Project"
},
"content": {
"categories_info": {
"basics": {
"name": "Basics",
"description": "General knowledge base and overview content."
},
"reference": {
"name": "Reference",
"description": "API references and glossary."
}
}
},
"outputs": {
"public_root": "/ai/"
}
}- Detection: The plugin hooks into the
on_page_markdownevent and looks for a page namedai-resources.md(by filename). - Generation:
- It replaces the page content with a standard Introduction/Overview using the
project.name. - It generates a table including:
- Standard Files:
llms.txt,site-index.json,llms-full.jsonl. - Categories: Iterates through
categories_info(in key order) to create rows for each category bundle.
- Standard Files:
- It replaces the page content with a standard Introduction/Overview using the
- Client-side actions: Each table row includes a split-button dropdown (generated via the shared
ai_file_utilslibrary) with copy, view, download, and LLM tool actions. For sites deployed under a subpath (e.g.,site_url: https://example.com/docs/), the path prefix is extracted fromsite_urland prepended to all artifact URLs automatically.
- This plugin is designed to work in tandem with the
resolve_mdplugin (which generates the actual artifact files) and theai_file_utilsshared library (which provides the dropdown UI). Client-side JavaScript (ai-file-actions.js) handles the button actions. - If
project.nameis missing fromllms_config.json, the build will fail with an error to prevent incorrect branding.