llms.txt file (for AI)
2 posts by 2 authors in: Forums > CMS Builder
Last Post: 11 hours ago (RSS)
By Jesus - Tuesday at 10:11pm
I know it's not fully approved yet, but is it possible to generate llms.txt files with CMSBuilder to place them in the root folder of the site so that AI can use them to better understand the content of the website?
I think it might be similar to a sitemap.xml (I don't know if it exists in CMSBuilder).
Thank you in advance for helping me with these issues.
Jesus
By Dave - 11 hours ago
Hi Jesus,
Yes, you can use .htaccess and mod_rewrite to tell your web server to use a PHP file to generate the response. Here's an example:
<?php
declare(strict_types=1);
/**
* /llms.txt Generator
*
* Dynamically generates /llms.txt responses in Markdown format (text/plain).
* See: https://llmstxt.org/
*
* To enable, add to .htaccess:
* <IfModule mod_rewrite.c>
* RewriteEngine On
* RewriteRule ^llms\.txt$ llms.txt.php [L]
* </IfModule>
*/
header('Content-Type: text/plain; charset=utf-8');
// Add your llms.txt content here (Markdown format)
echo "Hello from PHP\n";
Just save that as llms.txt.php, add the code to your .htaccess file, and then request /llms.txt in the browser to test.
Hope that helps! Let me know if you have any other questions.
interactivetools.com