Skip to content
Snippets Groups Projects

ISTWCMS-5705 Prevent webforms themselves from being indexed

1 file
+ 11
8
Compare changes
  • Side-by-side
  • Inline
+ 11
8
@@ -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'];
}
}
}
Loading