$rev, 'version' => $version, 'summary' => ( 'summary' === $variant ) ? $text : self::generate_summary_content(), 'full' => ( 'full' === $variant ) ? $text : self::generate_full_content(), ); } else { $entry[ $variant ] = $text; } update_option( 'aeolynx_llmstxt_cache', $entry, false ); return $text; } public static function generate_summary_content() { $limit_pages = (int) apply_filters( 'aeolynx_llmstxt_page_limit', 10 ); $limit_posts = (int) apply_filters( 'aeolynx_llmstxt_post_limit', 15 ); $limit_products = (int) apply_filters( 'aeolynx_llmstxt_product_limit', 10 ); $site_name = wp_strip_all_tags( (string) get_bloginfo( 'name' ) ); $site_desc = wp_strip_all_tags( (string) get_bloginfo( 'description' ) ); $lines = array(); $lines[] = '# ' . ( '' !== $site_name ? $site_name : 'WordPress Site' ); if ( '' !== $site_desc ) { $lines[] = ''; $lines[] = '> ' . $site_desc; } $lines[] = ''; $lines[] = 'This site supports the Model Context Protocol (WebMCP) and clean Markdown content negotiation for AI agents and answer engines. Append `?format=markdown` to any article URL to retrieve clean semantic Markdown.'; $lines[] = ''; $lines[] = '## Model Context Protocol (MCP) Endpoints'; $lines[] = '- [Well-Known MCP Server](' . home_url( '/.well-known/mcp.json' ) . '): Discovery metadata and server endpoints'; $lines[] = '- [MCP Manifest](' . rest_url( 'aeolynx/v1/manifest' ) . '): Full JSON Schema tool definitions'; $lines[] = '- [Callable Read Tools](' . rest_url( 'aeolynx/v1/tools' ) . '): `getSiteInfo`, `searchSite`, `getFeaturedContent`, `getPostContent`, `getSiteTaxonomies`, `getCatalogItems`'; if ( (bool) get_option( 'aeolynx_llmsfull_enabled', 1 ) ) { $lines[] = '- [Full Corpus Index](' . home_url( '/llms-full.txt' ) . '): Extended Markdown summaries of published content'; } $pages = get_posts( array( 'post_type' => 'page', 'post_status' => 'publish', 'has_password' => false, 'posts_per_page' => $limit_pages, 'no_found_rows' => true, 'orderby' => 'menu_order', 'order' => 'ASC', ) ); $pages = array_values( array_filter( $pages, array( 'AEOLynx_Frontend', 'is_public_post' ) ) ); if ( ! empty( $pages ) ) { $lines[] = ''; $lines[] = '## Key Pages'; foreach ( $pages as $page ) { $title = wp_strip_all_tags( get_the_title( $page ) ); $url = get_permalink( $page ); $sum = AEOLynx_Activity_Log::get_effective_ai_summary( $page ); $lines[] = sprintf( '- [%s](%s): %s', $title, $url, $sum ); } } $posts = get_posts( array( 'post_type' => 'post', 'post_status' => 'publish', 'has_password' => false, 'posts_per_page' => $limit_posts, 'no_found_rows' => true, ) ); $posts = array_values( array_filter( $posts, array( 'AEOLynx_Frontend', 'is_public_post' ) ) ); if ( ! empty( $posts ) ) { $lines[] = ''; $lines[] = '## Recent Articles'; foreach ( $posts as $post ) { $title = wp_strip_all_tags( get_the_title( $post ) ); $url = get_permalink( $post ); $sum = AEOLynx_Activity_Log::get_effective_ai_summary( $post ); $lines[] = sprintf( '- [%s](%s): %s ([Markdown](%s))', $title, $url, $sum, add_query_arg( 'format', 'markdown', $url ) ); } } if ( post_type_exists( 'product' ) ) { $products = get_posts( array( 'post_type' => 'product', 'post_status' => 'publish', 'has_password' => false, 'posts_per_page' => $limit_products, 'no_found_rows' => true, ) ); $products = array_values( array_filter( $products, array( 'AEOLynx_Frontend', 'is_public_post' ) ) ); if ( ! empty( $products ) ) { $lines[] = ''; $lines[] = '## Products & Catalog'; foreach ( $products as $prod ) { $title = wp_strip_all_tags( get_the_title( $prod ) ); $url = get_permalink( $prod ); $sum = AEOLynx_Activity_Log::get_effective_ai_summary( $prod ); $lines[] = sprintf( '- [%s](%s): %s', $title, $url, $sum ); } } } return implode( "\n", $lines ) . "\n"; } /** * Build the /llms-full.txt comprehensive corpus digest. * * @return string */ public static function generate_full_content() { $limit_full = (int) apply_filters( 'aeolynx_llmstxt_full_limit', 20 ); $lines = array(); $lines[] = self::generate_summary_content(); $lines[] = '## Full Article Summaries & Structured Digest'; $lines[] = ''; $posts = get_posts( array( 'post_type' => array( 'post', 'page' ), 'post_status' => 'publish', 'has_password' => false, 'posts_per_page' => $limit_full, 'no_found_rows' => true, ) ); foreach ( $posts as $post ) { if ( ! AEOLynx_Frontend::is_public_post( $post ) ) { continue; } $lines[] = '### ' . wp_strip_all_tags( get_the_title( $post ) ); $lines[] = '- URL: ' . get_permalink( $post ); $lines[] = '- Published: ' . get_the_date( 'Y-m-d', $post ); $sum = AEOLynx_Activity_Log::get_effective_ai_summary( $post ); if ( '' !== $sum ) { $lines[] = '- AI Summary: ' . $sum; } $lines[] = ''; $lines[] = wp_trim_words( AEOLynx_Markdown::convert_html_to_markdown( $post->post_content ), 120 ); $lines[] = ''; } return implode( "\n", $lines ) . "\n"; } } }