Skip to content

Instantly share code, notes, and snippets.

@proweb
Created May 9, 2017 11:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save proweb/99551ec75cf55b8ed523e0d83aa1209e to your computer and use it in GitHub Desktop.
Drupal 7 - remove shortlink, rel=alternate and generator meta tag
function themename_html_head_alter(&$head_elements) {
foreach ($head_elements as $key => $element) {
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'shortlink') {
unset($head_elements[$key]);
}
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'alternate') {
unset($head_elements[$key]);
}
}
unset($head_elements['system_meta_generator']);
$head_elements['system_meta_content_type']['#attributes'] = array(
'charset' => 'utf-8'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment