Apart from removing the generator meta tag in Drupal 8, tags such as MobileOptimized
and HandheldFriendly
are not needed either:
function THEME_NAME_page_attachments_alter(&$page){ $meta_tags = array('system_meta_generator', 'MobileOptimized', 'HandheldFriendly'); foreach ($page['#attached']['html_head'] as $key => $value) { if (in_array($value[1], $meta_tags)) { unset($page['#attached']['html_head'][$key]); } } }
In Drupal 8, the meta generator is system_meta_generator
Got any Drupal 8 tips or something you want us to write about! Let us know in the comments!
Sorry, but the script does not work under 8.2.x, how should we change it?
Thanks. It works on D8 8.3.5