Remove the Drupal 8 Generator Meta Tag

Published on Author techb43 Comments

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!

3 Responses to Remove the Drupal 8 Generator Meta Tag

  1. Hello there

    SEO Link building is a process that requires a lot of time fo techb4.com
    If you aren’t using SEO software then you will know the amount of work load involved in creating accounts, confirming emails and submitting your contents to thousands of websites in proper time and completely automated.

    With THIS SOFTWARE the link submission process will be the easiest task and completely automated, you will be able to build unlimited number of links and increase traffic to your websites which will lead to a higher number of customers and much more sales for you.
    With the best user interface ever, you just need to have simple software knowledge and you will easily be able to make your own SEO link building campaigns.

    The best SEO software you will ever own, and we can confidently say that there is no other software on the market that can compete with such intelligent and fully automatic features.
    The friendly user interface, smart tools and the simplicity of the tasks are making THIS SOFTWARE the best tool on the market.

    IF YOU’RE INTERESTED, CONTACT ME ==> seosubmitter@mail.com

    Regards,
    Rueben

Leave a Reply

Your email address will not be published. Required fields are marked *