/** * The llms.txt module. * * @package RankMath * @subpackage RankMath\LLMS */ namespace RankMath\LLMS; use RankMath\Helper; use RankMath\Traits\Hooker; use RankMath\Helpers\Arr; use RankMath\Sitemap\Sitemap; use RankMath\Sitemap\Router; use RankMath\Helpers\Url; use WP_Query; defined( 'ABSPATH' ) || exit; /** * LLMS_Txt class. */ class LLMS_Txt { use Hooker; /** * Class constructor. * * Registers hooks and filters for the llms.txt module. */ public function __construct() { $this->action( 'init', 'add_rewrite_rule' ); $this->action( 'template_redirect', 'maybe_serve_llms_txt' ); $this->filter( 'rank_math/settings/general', 'add_settings' ); $this->action( 'wp_loaded', 'remove_canonical_redirect' ); } /** * Remove the canonical redirect for the llms.txt file. * * @hook wp_loaded * @return void */ public function remove_canonical_redirect() { if ( strpos( Url::get_current_url(), '/llms.txt' ) !== false ) { remove_filter( 'template_redirect', 'redirect_canonical' ); } } /** * Add the llms.txt settings tab to the General settings panel. * * @hook rank_math/settings/general * * @param array $tabs Option panel tabs. * @return array Modified tabs array with llms.txt tab added. */ public function add_settings( $tabs ) { Arr::insert( $tabs, [ 'llms' => [ 'icon' => 'rm-icon rm-icon-bot', 'title' => esc_html__( 'Edit llms.txt', 'rank-math' ), 'desc' => esc_html__( 'Configure your llms.txt file for custom crawling/indexing rules.', 'rank-math' ), 'file' => __DIR__ . '/options.php', 'classes' => 'rank-math-advanced-option', 'json' => [ 'llmsUrl' => esc_url( home_url( '/llms.txt' ) ), ], ], ], 5 ); return $tabs; } /** * Add the rewrite rule and query var for llms.txt. * * @hook init * @return void */ public function add_rewrite_rule() { add_rewrite_rule( '^llms\.txt$', 'index.php?llms_txt=1', 'top' ); add_rewrite_tag( '%llms_txt%', '1' ); } /** * Serve the llms.txt file if the endpoint is hit. * * @hook template_redirect * @return void */ public function maybe_serve_llms_txt() { if ( intval( get_query_var( 'llms_txt' ) ) !== 1 ) { return; } if ( substr( Url::get_current_url(), -1 ) === '/' ) { wp_safe_redirect( home_url( '/llms.txt' ) ); exit; } $this->output(); exit; } /** * Output the llms.txt file content in Markdown format. * * @action rank_math/llms_txt/before_output Fires before llms.txt output is sent. * @action rank_math/llms_txt/after_output Fires after llms.txt output is sent. * @filter rank_math/llms_txt/posts_query_args Filter WP_Query args for posts. * @filter rank_math/llms_txt/posts Filter post IDs to include. * @filter rank_math/llms_txt/terms Filter term IDs to include. * @filter rank_math/llms_txt/extra_content Filter extra content output. * * @return void */ public function output() { if ( headers_sent() ) { return; } header( 'Content-Type: text/plain; charset=utf-8' ); header( 'X-Meta-Title: Foto Morgenegg LLMS.TXT' ); header( 'X-Meta-Description: Das LLMS.TXT File für Fotomedia Morgenegg AG.' ); header( 'X-Robots-Tag: ' ); /** * Fires before the llms.txt output is sent to the browser. * * @since 1.0.250 */ $this->do_action( 'llms_txt/before_output' ); $limit = absint( Helper::get_settings( 'general.llms_limit', 100 ) ); $this->add_header_content(); $this->add_post_types_data( $limit ); $this->add_taxonomies_data( $limit ); $this->add_extra_content(); /** * Fires after the llms.txt output is sent to the browser. * * @since 1.0.250 */ $this->do_action( 'llms_txt/after_output' ); } /** * Adds header content to the llms.txt output. * * @return void */ private function add_header_content() { $site_title = Helper::get_settings( 'titles.knowledgegraph_name', get_bloginfo( 'name' ) ); $site_desc = Helper::get_settings( 'titles.organization_description', get_bloginfo( 'description' ) ); $site_title .= $site_desc ? ': ' . $site_desc : ''; $this->output_line( '# Fotogeschäft mit Fotostudio in Zürich | Foto Morgenegg' ); $this->output_line( '' ); $this->output_line( '> ' . $site_title ); $this->output_line( '' ); $this->output_line( 'Below you can find the most important pages from our business:' ); $this->output_line( '' ); if ( ! Helper::is_module_active( 'sitemap' ) ) { return; } $this->output_line( '' ); $sitemap_url = Router::get_base_url( Sitemap::get_sitemap_index_slug() . '.xml' ); $this->output_line( '## Sitemaps' ); $this->output_line( '[XML Sitemap](' . esc_url( $sitemap_url ) . '): Includes all crawlable and indexable pages.' ); // Add an extra blank line after the header content. $this->output_line( '' ); } /** * Adds post type data to the llms.txt output. * * @param int $limit The maximum number of posts to include per post type. * @return void */ private function add_post_types_data( $limit ) { $post_types = Helper::get_settings( 'general.llms_post_types', [] ); if ( empty( $post_types ) ) { return; } foreach ( $post_types as $post_type ) { $args = [ 'post_type' => $post_type, 'post_status' => 'publish', 'posts_per_page' => $limit, 'no_found_rows' => true, ]; /** * Filter the WP_Query arguments used to fetch posts for llms.txt. * * @since 1.0.250 * @param array $args The WP_Query arguments. * @return array Modified WP_Query arguments. */ $args = $this->do_filter( 'llms_txt/posts_query_args', $args ); $query = new \WP_Query( $args ); /** * Filter the list of post IDs to be included in llms.txt for a post type. * * @since 1.0.250 * @param array $posts List of posts. * @param array $args The WP_Query arguments. * @return array Modified list of post IDs. */ $posts = $this->do_filter( 'llms_txt/posts', $query->posts, $args ); if ( empty( $posts ) ) { continue; } $label = get_post_type_object( $post_type )->labels->name; $this->output_line( '## ' . esc_html( $label ) ); foreach ( $posts as $object ) { if ( ! Helper::is_post_indexable( $object ) ) { continue; } $title = get_the_title( $object ); $link = get_permalink( $object ); $desc = wp_strip_all_tags( Helper::replace_vars( '%excerpt%', $object ) ); $this->output_line( $desc ? '- [' . esc_html( $title ) . '](' . esc_url( $link ) . '): ' . esc_html( $desc ) : '- [' . esc_html( $title ) . '](' . esc_url( $link ) . ')' ); } $this->output_line( '' ); } } /** * Adds taxonomy data to the llms.txt output. * * @param int $limit The maximum number of terms to include per taxonomy. * @return void */ private function add_taxonomies_data( $limit ) { $taxonomies = Helper::get_settings( 'general.llms_taxonomies', [] ); if ( empty( $taxonomies ) ) { return; } foreach ( $taxonomies as $taxonomy ) { $tax_obj = get_taxonomy( $taxonomy ); if ( ! $tax_obj ) { continue; } $terms = get_terms( [ 'taxonomy' => $taxonomy, 'hide_empty' => true, 'number' => $limit, ] ); /** * Filter the list of terms to be included in llms.txt for a taxonomy. * * @since 1.0.250 * @param array $terms List of terms. * @param string $taxonomy Taxonomy name. * @return array Modified list of term IDs. */ $terms = $this->do_filter( 'llms_txt/terms', $terms, $taxonomy ); if ( empty( $terms ) ) { continue; } $label = $tax_obj->labels->name; $this->output_line( '## ' . esc_html( $label ) ); foreach ( $terms as $term ) { if ( $term && Helper::is_term_indexable( $term ) ) { $name = $term->name; $link = get_term_link( $term ); $this->output_line( '- [' . esc_html( $name ) . '](' . esc_url( $link ) . ')' ); } } $this->output_line( '' ); } } /** * Adds extra content to the end of the llms.txt output. * * @return void */ private function add_extra_content() { /** * Filter the extra content output at the end of llms.txt. * * @since 1.0.250 * @param string $extra The extra content string. * @return string Modified extra content. */ $extra = $this->do_filter( 'llms_txt/extra_content', Helper::get_settings( 'general.llms_extra_content', '' ) ); if ( ! empty( $extra ) ) { $this->output_line( esc_html( str_replace( "\n", "\n", $extra ) ) ); } } /** * Outputs a line with a newline character (\n). * * @param string $content The content to output. * @return void */ private function output_line( $content ) { echo $content . "\n"; } } https://fotomorgenegg.ch/tierfotograf/ 2025-12-06T15:16:34+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/07/Hundeshooting-Z%C3%BCrich.jpg https://fotomorgenegg.ch/bilderrahmen/ 2025-10-01T20:01:54+00:00 https://fotomorgenegg.ch/wp-content/uploads/2021/12/Bilderrahmen-nach-Mass-Rahmen.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/bildveredelung-kopie-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/11/Passepartout-Z%C3%BCrich.png https://fotomorgenegg.ch/wp-content/uploads/2017/11/Einrahmungen-Rahmen-nach-Mass-1024x592.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/07/Jenzer-Zoe-1024x681.jpg https://fotomorgenegg.ch/weihnachts-fotoshooting/ 2025-09-29T19:05:27+00:00 https://fotomorgenegg.ch/wp-content/uploads/2023/11/Geschwister_XMAS_Shooting_lang.jpg https://fotomorgenegg.ch/wp-content/uploads/2022/12/Fotopuzzle-als-Geschenkidee.jpg https://fotomorgenegg.ch/wp-content/uploads/2022/12/Adventskalender-mit-Schokolade-Geschenkidee.jpg https://fotomorgenegg.ch/wp-content/uploads/2022/12/Wandkalender-mit-eigenen-Fotos-Gechenkidee.jpg https://fotomorgenegg.ch/wp-content/uploads/2022/12/Schluesselanhaenger-als-Geschenkidee.jpg https://fotomorgenegg.ch/die-bedeutung-professioneller-unternehmensfotografie/ 2025-09-27T17:31:33+00:00 https://fotomorgenegg.ch/wp-content/uploads/2018/02/business-portfolio-16-1.jpg https://fotomorgenegg.ch/die-50-jaehrige-erfolgsgeschichte/ 2025-09-19T20:52:14+00:00 https://fotomorgenegg.ch/wp-content/uploads/2024/11/Teambild-Fotomedia-Morgenegg-AG-2024.jpg https://fotomorgenegg.ch/wp-content/uploads/2024/03/Altes-Fotolabor.jpg https://fotomorgenegg.ch/wp-content/uploads/2024/03/Polaroid-Aufnahme-Foto-Cine-Morgenegg.png https://fotomorgenegg.ch/outdoor-familienfotoshooting/ 2025-09-13T19:45:14+00:00 https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-18-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2024/04/FMM6732-1024x683.jpg https://fotomorgenegg.ch/wp-content/uploads/2024/04/Outdoor-Familien-Fotoshooting-1024x683.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-18-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-04-1-1024x576.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-50.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-100.jpg https://fotomorgenegg.ch/wp-content/uploads/2024/04/Familien-Fotoshooting-Gutschein-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-200.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-500.jpg https://fotomorgenegg.ch/wp-content/uploads/2024/04/Familien-Fotoshooting-Gutschein.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-500.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-200.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Geschenkgutschein-100.jpg https://fotomorgenegg.ch/bewerbungsfoto/ 2025-09-08T12:56:27+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/03/Portfolio_12-Kopie.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/10/Linkedin-Profil.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/10/Business_Bewerbung_mit_Hintergund_Foto.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/10/Business_Bewerbung_mit_Hintergund_Foto2.jpg https://fotomorgenegg.ch/drucksachen-kopien-binden-und-laminieren/ 2025-08-21T19:30:55+00:00 https://fotomorgenegg.ch/wp-content/uploads/2021/11/Fotogeschenke-online-bestellen.jpg https://fotomorgenegg.ch/kinder-fotoshooting/ 2025-07-30T21:40:15+00:00 https://fotomorgenegg.ch/wp-content/uploads/2020/07/Babyfotograf-Z%C3%BCrich-Baby-Fotoshooting-Zwillinge.jpg https://fotomorgenegg.ch/wp-content/uploads/2020/07/Jausenbox.jpg https://fotomorgenegg.ch/wp-content/uploads/2020/07/Milka-Herz.jpg https://fotomorgenegg.ch/wp-content/uploads/2020/07/Tasse-mit-L%C3%A4ffel.jpg https://fotomorgenegg.ch/wp-content/uploads/2020/07/Babyl%C3%A4tzchen.jpg https://fotomorgenegg.ch/wp-content/uploads/2020/07/Latte-Macchiato-Tasse.jpg https://fotomorgenegg.ch/wp-content/uploads/2020/07/Trinkflasche.jpg https://fotomorgenegg.ch/mini-ostern-fotoshooting/ 2025-07-30T21:40:04+00:00 https://fotomorgenegg.ch/wp-content/uploads/2023/03/Oster-Fotoshooting-Aktion-3.jpg https://fotomorgenegg.ch/wp-content/uploads/2023/03/Ostergeschenke-Ideen.jpg https://fotomorgenegg.ch/hochzeitsfotograf/ 2025-07-30T16:11:21+00:00 https://fotomorgenegg.ch/wp-content/uploads/2018/02/hochzeits-portfolio-06-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/05/Renate-Benizcky.jpg https://fotomorgenegg.ch/akt-erotik-fotoshooting/ 2025-07-30T16:07:11+00:00 https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-03-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-10-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-11-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-09-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-04-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-13-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-12-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/01/akt-portfolio-08-1.jpg https://fotomorgenegg.ch/familien/ 2025-07-30T13:47:40+00:00 https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-20-1.jpg https://fotomorgenegg.ch/babybauch-fotografie/ 2025-07-28T18:42:46+00:00 https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-02-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-02-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-03-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-05-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2017/12/family-portfolio-26-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2025/02/dsc4476_1-scaled.jpg https://fotomorgenegg.ch/wp-content/uploads/2025/02/dsc_4932-scaled.jpg https://fotomorgenegg.ch/passfotos/ 2025-07-28T18:10:40+00:00 https://fotomorgenegg.ch/wp-content/uploads/2023/03/Fotograf-fuer-biometrische-Passbilder-in-Zuerich.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/03/Passbilder_2-1-Kopie-f%C3%BCr-homepage.jpg https://fotomorgenegg.ch/film-und-videoueberspielungen/ 2025-07-22T18:41:19+00:00 https://fotomorgenegg.ch/wp-content/uploads/2017/10/film-videoklein-1.jpg https://fotomorgenegg.ch/mietservice/ 2025-07-03T11:44:42+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/03/jeff-hopper-17306-unsplash-scaled.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/05/Fotomedia-Morgenegg-AG-Fotostudio-mieten-Zuerich.jpg https://fotomorgenegg.ch/business-fotograf/ 2025-05-07T19:35:45+00:00 https://fotomorgenegg.ch/wp-content/uploads/2018/02/business-portfolio-01-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/03/FMM_7286-sw-Kopie.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/03/FMM5555-Kopie.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/Alpentoffee-Banner-Produktaufnahme.jpg https://fotomorgenegg.ch/fotos-negative-und-dias-digitalisieren/ 2025-05-07T19:00:21+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/05/negative-und-dias-digitalisieren.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/Alte-Negative-digitalisieren-Z%C3%BCrich-unbearbeitet.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/Alte-Negative-digitalisieren-Z%C3%BCrich-optimiert.jpg https://fotomorgenegg.ch/foto-poster/ 2025-05-07T18:28:06+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/12/foto-poster-bestellen.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/foto-poster-bestellen.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/alu-dibond-bestellen.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/foto-leinwand-bestellen.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Fotogeschenke-online-bestellen-300x166.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/05/fotos-drucken-300x200.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/05/negative-und-dias-digitalisieren-300x200.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/12/Bilderrahmen-nach-Mass-Rahmen-300x200.jpg https://fotomorgenegg.ch/fotos-drucken/ 2025-05-07T18:01:01+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/05/fotos-drucken.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/11/Fotogeschenke-online-bestellen-300x166.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/foto-poster-bestellen.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/05/negative-und-dias-digitalisieren-300x200.jpg https://fotomorgenegg.ch/wp-content/uploads/2021/12/Bilderrahmen-nach-Mass-Rahmen-300x200.jpg https://fotomorgenegg.ch/fotokurse/ 2025-04-08T13:09:39+00:00 https://fotomorgenegg.ch/wp-content/uploads/2017/10/kurs4-1-e1563987134283-scaled.jpg https://fotomorgenegg.ch/paar-shooting/ 2025-02-27T19:47:33+00:00 https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-10-2.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-08-2.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-01-2.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-05-2.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-03-2.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-11-2.jpg https://fotomorgenegg.ch/wp-content/uploads/2018/02/paar-portfolio-07-2.jpg https://fotomorgenegg.ch/wie-viel-kostet-eine-hochzeit/ 2025-02-18T20:31:35+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/05/poster-drucken.jpg https://fotomorgenegg.ch/wp-content/uploads/2023/09/fotomorgenegg_hochzeitsfotograf_073.jpg https://fotomorgenegg.ch/kids-herbst-fotoshooting/ 2025-02-12T09:16:57+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/09/Fotomorgenegg-Kinder-Herbstshooting.jpg https://fotomorgenegg.ch/portraitfotograf/ 2024-12-09T15:19:12+00:00 https://fotomorgenegg.ch/wp-content/uploads/2017/12/people-portfolio-11-1.jpg https://fotomorgenegg.ch/beste-monitore-fuer-fotografen-und-bildbearbeiter/ 2024-08-17T00:31:51+00:00 https://fotomorgenegg.ch/wp-content/uploads/2019/12/Eizo-CG279X-Swiss-Garantie.png https://fotomorgenegg.ch/wp-content/uploads/2019/12/ColorEdge-CG247X-Front-Left-Angle-sRGB-1024x978.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/CG319X-colorgamut-sRGB.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/CG279X-l-hood-selfcal-sRGB-1024x881.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/12/CG319X-built-in-sensor-sRGB-1024x750.jpg https://fotomorgenegg.ch/eventfotografie/ 2023-11-13T20:12:31+00:00 https://fotomorgenegg.ch/wp-content/uploads/2018/02/event_007-1.jpg https://fotomorgenegg.ch/wp-content/uploads/2019/05/online-proofing-photographers-website.png