One of the first thing I always like to do when implementing a CMS is to get rid of that annoying Meta tag that shows off what CMS I am running.
Point in case;
<meta name="Generator" content="Drupal 8 (https://www.drupal.org)" />
Took me a while (as usual, being a Drupal 8 noob and all).
Where you see "MYTHEME" - obvioulsy replace with the name of your own theme or sub-theme.
- Server Root.
- Themes.
- In the file MYTHEME.theme simply add;
<?php
function MYTHEME_page_attachments_alter(array &$page) {
$unset_meta = [
'system_meta_generator', // Meta name "Generator"
];
foreach ($page['#attached']['html_head'] as $key => $value) {
if (in_array($value[1], $unset_meta)) unset($page['#attached']['html_head'][$key]);
}
}
- Save the file.
- Flush All caches.
- And inspect source.
Still trying to get rid of the following but to no avail as of yet :(
- <link rel="shortlink" href="/node/**" />
- <link rel="delete-form" href="/node/**/delete" />
- <link rel="edit-form" href="/node/**/edit" />
- <link rel="version-history" href="/node/**/revisions" />
- <link rel="revision" href="/**/**" />
Each day as I am learning I am finding out how amazing Drupal 8 actually is, I seriously am loving that the nerd in me is coming to the fore with every passing day.
No comments:
Post a Comment