删除“ Generator”元标记?


10

在Drupal 8中删除“ Generator”元标记的最简单方法是什么?

<meta name="Generator" content="Drupal 8 (https://www.drupal.org)" />

可以仅用几行代码来完成吗?

Answers:


15

对于其他所有人(来自drupal.org/node/2676164):

/**
 * Implements hook_page_attachments_alter().
 */
function HOOK_page_attachments_alter(array &$attachments) {
  foreach ($attachments['#attached']['html_head'] as $key => $attachment) {
    if ($attachment[1] == 'system_meta_generator') {
      unset($attachments['#attached']['html_head'][$key]);
    }
  }
}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.