llms.txt file (for AI)

4 posts by 4 authors in: Forums > CMS Builder
Last Post: March 25   (RSS)

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

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.

Dave Edis - Senior Developer
interactivetools.com

By Codee - March 21 - edited: March 21

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.