From 502019d7537d4a44b022453209765ee8993406d2 Mon Sep 17 00:00:00 2001 From: Anuprita Kulkarni <a5kulkar@uwaterloo.ca> Date: Fri, 26 Aug 2022 11:23:25 -0400 Subject: [PATCH] ISTWCMS-5705 Prevent webforms themselves from being indexed fixed only for webforms --- uw_cfg_common.module | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/uw_cfg_common.module b/uw_cfg_common.module index fb1c0f1b..ed65d98a 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -1317,13 +1317,16 @@ function uw_cfg_common_preprocess_html(&$variables): void { // Setting the meta tag for web forms getting indexed // if not used any content. if (!isset($variables['node_type']) || $variables['node_type'] == NULL) { - $noindex = [ - '#tag' => 'meta', - '#attributes' => [ - 'name' => 'robots', - 'content' => 'noindex', - ], - ]; - $variables['page']['#attached']['html_head'][] = [$noindex, 'noindex']; + if ($variables['root_path'] === 'webform') { + $noindex = [ + '#tag' => 'meta', + '#attributes' => [ + 'name' => 'robots', + 'content' => 'noindex', + ], + ]; + $variables['page']['#attached']['html_head'][] = [$noindex, 'noindex']; + } } + } -- GitLab