llms.txt file (for AI)
4 posts by 4 authors in: Forums > CMS Builder
Last Post: 9 hours ago (RSS)
By Jesus - November 4
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 - November 6
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
By Codee - Saturday at 7:30pm - edited: Saturday at 7:31pm
Are you saying this little bit of code will generate all the llms.txt content for a site run by cmsb? I am hoping there is a method for doing so. I figured a plugin might be needed.
By Lucia - 9 hours ago
Hi Codee,
The above is just a snippet that helps set up a PHP file that will load when "llms.txt" is accessed. On its own it does not generate any of the content, but it's a good first step in being able to do so.
Technical Lead
interactivetools.com