Remove "Generator" meta tag? How can I remove the Generator meta-tag in Drupal 8?
&lt;meta name=&quot;Generator&quot; content=&quot;Drupal 8 (https://www.drupal.org)&quot; /&gt;

Can this be done with few lines of code?
Basing on the patch provided in Remove Generator META tag &amp; X-Generator for Drupal 8 version! this is the code that would achieve that.
/**
 * Implements hook_page_attachments_alter().
 */
function HOOK_page_attachments_alter(array &amp;$attachments) {
  foreach ($attachments['#attached']['html_head'] as $key =&gt; $attachment) {
    if ($attachment[1] == 'system_meta_generator') {
      unset($attachments['#attached']['html_head'][$key]);
    }
  }
}