diff --git a/robots.txt b/robots.txt index cb0dea2..7aed71f 100644 --- a/robots.txt +++ b/robots.txt @@ -42,6 +42,7 @@ Disallow: /cabinet/ Clean-param: age&grade&sort&filter&view&sid&_openstat / Clean-param: utm_source&utm_medium&utm_campaign&utm_content&utm_term&from / Clean-param: ref&_openstat&sid / +Clean-param: clckid&yclid&gclid&etext&y_ref / # Глобальная директива Sitemap (видна всем ботам) Sitemap: https://schelkovo.dekart.school/sitemap_index.xml diff --git a/wp-content/themes/dekart/functions.php b/wp-content/themes/dekart/functions.php index e6deb6e..f0bff09 100644 --- a/wp-content/themes/dekart/functions.php +++ b/wp-content/themes/dekart/functions.php @@ -3515,6 +3515,29 @@ function dekart_acf_delete_json($post_id) // (ТОП-меню удалено; опции зарегистрированы в dekart_branch_group; // вывод на фронте — те же хуки wp_head/wp_body_open/wp_footer) // ───────────────────────────────────────────────────────────── +/** + * True on dev/local hosts — счётчики и трекеры на них не выводятся, + * чтобы dev-трафик не попадал в прод-Метрику/GA под внутренним IP + * (симптом: landing http://192.168.50.107:8081/ в целевом счётчике). + * Прод-домены (schelkovo/pushkino/balashiha.dekart.school, dekart-school.ru …) — не dev. + */ +function dekart_is_dev_host() +{ + $host = isset($_SERVER['HTTP_HOST']) ? strtolower((string) $_SERVER['HTTP_HOST']) : ''; + $host = preg_replace('/:\d+$/', '', $host); // strip port + if ($host === '') { + return true; + } + $dev_hosts = array('localhost', '127.0.0.1', '::1', '192.168.50.107'); + if (in_array($host, $dev_hosts, true)) { + return true; + } + if (strpos($host, 'dev.') === 0 || substr($host, -6) === '.local') { + return true; + } + return (bool) filter_var($host, FILTER_VALIDATE_IP); +} + add_action('admin_init', 'dekart_counters_settings'); function dekart_counters_settings() { @@ -3523,6 +3546,11 @@ function dekart_counters_settings() register_setting('dekart_counters_group', 'dekart_counter_gtm_body'); register_setting('dekart_counters_group', 'dekart_counter_footer'); + // На dev/local дефолтные прод-счётчики не заводим — не должны уехать в аналитику. + if (dekart_is_dev_host()) { + return; + } + $yandex_default = "\n\n"; $gtm_head_default = "\n\n"; @@ -3590,6 +3618,9 @@ function dekart_counters_page() add_action('wp_head', 'dekart_output_counters', 1); function dekart_output_counters() { + if (dekart_is_dev_host()) { + return; + } $yandex = stripslashes(get_option('dekart_counter_yandex', '')); $gtmhead = stripslashes(get_option('dekart_counter_gtm_head', '')); if ($yandex) { @@ -3603,6 +3634,9 @@ function dekart_output_counters() add_action('wp_body_open', 'dekart_output_gtm_body', 1); function dekart_output_gtm_body() { + if (dekart_is_dev_host()) { + return; + } $gtmbody = stripslashes(get_option('dekart_counter_gtm_body', '')); if ($gtmbody) { echo "\n" . $gtmbody . "\n"; @@ -3612,6 +3646,9 @@ function dekart_output_gtm_body() add_action('wp_footer', 'dekart_output_counters_footer', 100); function dekart_output_counters_footer() { + if (dekart_is_dev_host()) { + return; + } $footer = stripslashes(get_option('dekart_counter_footer', '')); if ($footer) { echo "\n" . $footer . "\n"; diff --git a/wp-content/themes/dekart/page-elementary-school.php b/wp-content/themes/dekart/page-elementary-school.php index ac70ae0..a297d8b 100644 --- a/wp-content/themes/dekart/page-elementary-school.php +++ b/wp-content/themes/dekart/page-elementary-school.php @@ -72,31 +72,31 @@ $school_modified = get_the_modified_time('c', $post_id); "@graph": [ { "@type": "WebPage", - "@id": "https://schelkovo.dekart.school/nachalnaya-shkola/", - "url": "https://schelkovo.dekart.school/nachalnaya-shkola/", + "@id": "/nachalnaya-shkola/", + "url": "/nachalnaya-shkola/", "name": "Частная начальная школа «Декарт» в Щелково: 1-4 классы", - "isPartOf": {"@id": "https://schelkovo.dekart.school/#website"}, + "isPartOf": {"@id": "/#website"}, "datePublished": "", "dateModified": "", "description": "Частная начальная школа «Декарт» в Щелково для учеников 1-4 классов. Углубленная программа, английский с 1 класса, классы до 12 человек. Запишитесь на экскурсию!", - "breadcrumb": {"@id": "https://schelkovo.dekart.school/nachalnaya-shkola/#breadcrumb"}, + "breadcrumb": {"@id": "/nachalnaya-shkola/#breadcrumb"}, "inLanguage": "ru-RU", "potentialAction": [ { "@type": "ReadAction", - "target": ["https://schelkovo.dekart.school/nachalnaya-shkola/"] + "target": ["/nachalnaya-shkola/"] } ] }, { "@type": "BreadcrumbList", - "@id": "https://schelkovo.dekart.school/nachalnaya-shkola/#breadcrumb", + "@id": "/nachalnaya-shkola/#breadcrumb", "itemListElement": [ { "@type": "ListItem", "position": 1, "name": "Главная страница", - "item": "https://schelkovo.dekart.school/" + "item": "/" }, { "@type": "ListItem", @@ -107,21 +107,21 @@ $school_modified = get_the_modified_time('c', $post_id); }, { "@type": "WebSite", - "@id": "https://schelkovo.dekart.school/#website", - "url": "https://schelkovo.dekart.school/", + "@id": "/#website", + "url": "/", "name": "Частная школа Декарт", "description": "Частная школа Декарт в Щелково", - "publisher": {"@id": "https://schelkovo.dekart.school/#organization"}, + "publisher": {"@id": "/#organization"}, "inLanguage": "ru-RU" }, { "@type": ["School", "LocalBusiness"], - "@id": "https://schelkovo.dekart.school/#organization", + "@id": "/#organization", "name": "Частная начальная школа «Декарт» в Щёлково", "description": "Лицензированная начальная школа в Щёлково. Малые классы, углубленная программа, продленка и всестороннее развитие ребенка.", - "url": "https://schelkovo.dekart.school/nachalnaya-shkola/", - "logo": "https://schelkovo.dekart.school/wp-content/uploads/2025/04/2-1-1.jpg", - "image": "https://schelkovo.dekart.school/wp-content/uploads/2023/05/logo-dekart.png", + "url": "/nachalnaya-shkola/", + "logo": "/wp-content/uploads/2025/04/2-1-1.jpg", + "image": "/wp-content/uploads/2023/05/logo-dekart.png", "telephone": "+79303334151", "address": { "@type": "PostalAddress",