From route options
use Silarhi\LlmsTxtBundle\Model\Section;use Silarhi\LlmsTxtBundle\Routing\LlmsTxtEntry;
#[Route('/contact', name: 'contact', options: ['llms_txt' => new LlmsTxtEntry( title: 'Contact', // required description: 'How to reach the team', // optional)])]public function contact(): Response
#[Route('/cgu', name: 'cgu', options: ['llms_txt' => new LlmsTxtEntry(title: 'CGU', section: Section::OPTIONAL)])]public function cgu(): Responsesection defaults to route_section. Routes declared in YAML or XML take the same keys as an array:
contact: path: /contact controller: App\Controller\ContactController options: llms_txt: { title: Contact, description: How to reach the team }Only routes without mandatory parameters can carry the option: add the others from a link provider.
Markdown versions
Section titled “Markdown versions”With markdown_versions, the link points to the Markdown version of the page when it has
a URL of its own: the path of the route has a {_format}, and its requirement lists md. The URL is generated with
_format: md.
#[Route('/guide.{_format}', name: 'guide', format: 'html', requirements: ['_format' => 'html|md'], options: [ 'llms_txt' => new LlmsTxtEntry(title: 'Guide'), // - [Guide](https://example.com/guide.md)])]An Accept-only page, without {_format} in its path, keeps the URL of the page. markdown: false keeps it too;
markdown: true forces the .md URL, which still needs a {_format} in the path.
Invalid options
Section titled “Invalid options”With LlmsTxtEntry, an empty title or section fails as soon as the routes load, cache:warmup included. The array
form is only checked when the file is generated: an empty title, an unknown key or a value of the wrong type fails the
requests of /llms.txt and llms-txt:dump, not the deployment.
Excluding a route
Section titled “Excluding a route”A route without the option, or with llms_txt: false, stays out of the file: false overrides an option set on a
whole imported route collection.
Caching
Section titled “Caching”Reading the option means loading every route file of the application, which the router does not do in production. The
routes carrying it are cached in %kernel.build_dir%/llms_txt_routes.php, next to the compiled routes and invalidated
with them: in debug, changing a route file rebuilds it. cache:warmup writes it, so a read-only build directory works.
The URLs are still generated on each request, as they depend on the request context.
