Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,13 @@ function minimalcode_maybe_flush_after_deploy() {
* hooks above, same as the virtual routes.
*/
add_action('init', function () {
add_rewrite_rule('^llms\.txt$', 'index.php?minimalcode_llms=1', 'top');
add_rewrite_rule('^llms\.txt/?$', 'index.php?minimalcode_llms=1', 'top');
});

// Serve /llms.txt at the exact path (like robots.txt) — WordPress's canonical
// redirect would otherwise 301 it to /llms.txt/, which AI crawlers don't expect.
add_filter('redirect_canonical', function ($redirect_url) {
return ('1' === (string) get_query_var('minimalcode_llms')) ? false : $redirect_url;
});
Comment on lines +479 to 483

add_filter('query_vars', function ($vars) {
Expand Down Expand Up @@ -511,5 +517,5 @@ function minimalcode_maybe_flush_after_deploy() {
header('Content-Type: text/plain; charset=utf-8');
echo implode("\n", $lines) . "\n";
exit;
});
}, 0);