Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.