Astral.Plugin.LLMs (Astral v0.3.1)

Copy Markdown View Source

Generates a metadata-driven /llms.txt index, without exporting page content.

By default, lists HTML pages and generated HTML routes in URL order. Generated routes take precedence over pages at the same output destination, as in builds. Drafts, error pages, and metadata declaring noindex: true, robots: "noindex", or llms: false are omitted. Exclusion is guidance, not access control.

Options

  • :title — required site name. Never inferred from the Mix application name.
  • :description — optional short site summary.
  • :site_url — optional absolute HTTP(S) site URL. Without it links are root-relative.
  • :exclude — route paths to omit, with trailing slashes treated equivalently.
  • :sections — ordered {heading, selectors} pairs. When omitted, a single "Pages" section lists all eligible routes. An empty list produces no sections.

A selector is a local route path, {:collection, name}, or a map containing :url and optional :title/:description overrides. External HTTP(S) URLs require a title. Local links infer their titles and descriptions from metadata; a page's first level-one Markdown heading is a title fallback, followed by its route path ("Home" for /). Unknown local paths and collections raise errors. Explicit selection never bypasses exclusions. Empty sections are omitted.

plugin Astral.Plugin.LLMs,
  title: "My site",
  sections: [
    {"Pages", ["/", "/about/"]},
    {"Writing", [{:collection, :posts}]},
    {"Optional", [%{title: "Source", url: "https://github.com/example/site"}]}
  ]

This plugin writes only llms.txt. It does not render, convert, or concatenate page bodies, generate Markdown alternates, or alter HTML layouts.

Summary

Functions

Return the plugin identifier.

Render the index from the final discovered route table in builds and development.

Register the llms.txt route after validating site-level options.

Functions

name()

Return the plugin identifier.

render_route(route, site, opts)

Render the index from the final discovered route table in builds and development.

routes(site, opts)

Register the llms.txt route after validating site-level options.